You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Easier and faster to implement a new operation, since no more writing two similar but also quite different (semi) parsers
More generic, ie the operation names aren't part of the grammar any more. This also helps with enabling plugins (the current prototype for this doesn't have proper parsing support).
Disadvantages:
Dealing with two slightly different textual inputs (e.g. operations in cli-ops start with -- while, script doesn't, perhaps we could make starting with -- optional like op_name = "--"? ~ op_ident)
Dealing with two different input methods. cli-ops are received through std::env::env() while script is received through files or text.
coord(10,2): named value with name type coord (arg 2)
rgba(255, 0, 0, 255): named value with name type rgba (arg 3)
size(14): named value with name type size (arg 4)
font('./Lato-Regular.ttf')': named value with name typefont` (arg 5)
For script, this is getting complex, but is workable. For cli-ops however this may be getting too complex.
Not using named values also isn't the best option, since a long list of numbers and text, makes it unclear what is what.
The current implementation cares about argument ordering, and perhaps the future should do too (?).
Inspired by python, maybe we should add named parameters (instead of values) like so:
Unified parser
Advantages:
Disadvantages:
--
while, script doesn't, perhaps we could make starting with--
optional likeop_name = "--"? ~ op_ident
)std::env::env()
while script is received through files or text.Breaking changes:
Proposed:
Currently, complex arguments are given like so:
Dissecting each component:
draw-text
: operation name<3
: string (arg 1)coord(10,2)
: named value with name typecoord
(arg 2)rgba(255, 0, 0, 255)
: named value with name typergba
(arg 3)size(14)
: named value with name typesize
(arg 4)font('./Lato-Regular.ttf')': named value with name type
font` (arg 5)For script, this is getting complex, but is workable. For cli-ops however this may be getting too complex.
Not using named values also isn't the best option, since a long list of numbers and text, makes it unclear what is what.
The current implementation cares about argument ordering, and perhaps the future should do too (?).
Inspired by python, maybe we should add named parameters (instead of values) like so:
where for example
pos = 10, 2
,coord
is the formal parameter name,10, 2
is a tuple with values10
and2
(using,
as tuple operator)The perhaps biggest question however is whether this is more ergonomic than the old syntax, and then what we could do to make it even more ergonomic.
At some point I would also like to add default values. Currently we use modifiers for this, but possibly optional arguments could be more ergonomic.
Efforts:
duo parser draft pr: #617
The text was updated successfully, but these errors were encountered: