home - plugins - tutorials - showcase - history - manual - design
this page documents dublang system design and architectural decisions, user interface proposals, feature proposals, and some work-in-progress ideas
it is used, but not limited, to document software design, language specification and user interface design
the format is inspired by some common formats, like debian enhancement proposals, proposed perl changes, python enhancement proposals and request for comments
each document is identified by
"d + $NUMBER"
, for example:
d1
, d2
, d3
, ..., dN
,
and it has a state among the itens: draft, exploring, ready, obsolete or
closed
dublang block annotation syntax to modify block evaluation, like dublang triggers but defined on block level instead of on shebang level
example (annotate blocks in any plugin and tell git to tag the commit)
#!echo
@git tag v2
hello world
[Serializable]
public class SampleClass {
}
@synchronized(lock)
def foo(cls):
pass
@Twizzle
public void toggle() {
}
dublang cycle()
function accepts a list of
anonymous function and execute each function on a infinite loop, called
cycle
a cycle has a fixed duration (by default defined as 1
second) and the cycle()
function executes each anonymous
function in a slice of that 1s duration
example (run 1st function on the time 0 and the 2nd function on the time 0.5 second)
#!dublang
cycle({
function()
vim.notify("run function 1")
end,
function()
vim.notify("run function 2")
end,
})
a cycle can be identified by a string, example
#!dublang
cycle("foo", {
function()
vim.notify("run function 1")
end,
function()
vim.notify("run function 2")
end,
})
if cycle function doesn't have and idenfier then it uses a global id and any other later cycle execution overwrites the previous one
see dublang cycle documentation here
:foo do
live_loop 60
play sleep 1
end
Tidal Cycles - cycles per second (CPS)
$ s "bd hh bd hh" d1
dublang hooks are Lua functions defined by user executed by events on other plugins
example (using dublang lua function hook()
)
#!dublang
-- using function hook() to create one hook function for tidalcycles
hook('tidalcycles', function(plugin, block)
if block:match("cp") then
mpv([[video "videos-dune:01"]])
else if block:match("bd") then
mpv([[video "videos-dune:02"]])
end
end
)
#!tidalcycles
d1 $ sound "cp"
d2 $ sound "bd*2"
example (using dublang lua function
hooks()
)
#!dublang
-- using function hooks() to create a chain of hook functions for tidalcycles
hooks('tidalcycles', {
function(plugin, block)
if block:match("cp") then
mpv([[video "videos-dune:01"]])
else if block:match("bd") then
mpv([[video "videos-dune:02"]])
end
end,
function(plugin, block)
-- hook function for tidalcycles
if block:match("squiz 0") then
mpv([[cas 1]])
elseif block:match("squiz %d") then
mpv([[edge $ mode wires]])
else
mpv([[clr]])
end
end,
})
#!tidalcycles
d1 $ sound "cp" # squiz 0
d1 $ sound "cp" # squiz 1
d2 $ sound "bd*2"
see dublang hooks documentation here
home - plugins - tutorials - showcase - history - manual - design