Open mtshiba opened 1 month ago
We propose syntax sugar for some of Erg's built-in subroutines, which will make Erg code look more similar to Python and be easier to use for users familiar with Python.
if
if cond: ... elif cond2: # optional ... else: # optional ...
desugared:
if cond: do: ... else := if cond2: do: ... else := do: ...
if!
if! cond: ... elif! cond2: # optional ... else!: # optional ...
while!
while! cond: ... else!: # optional ...
while! do! cond: do!: ... else! := do!: ...
for!
for! i in it: ... else!: ...
for! it: i => ... else! := do! ...
import
import foo import foo as bar import foo.bar as bar from foo import bar # import foo.bar # synyax error, we don't need this
foo = import "foo" bar = import "foo" bar = import "foo/bar" bar = import "foo/bar"
We propose syntax sugar for some of Erg's built-in subroutines, which will make Erg code look more similar to Python and be easier to use for users familiar with Python.
New
if
syntaxdesugared:
New
if!
syntaxNew
while!
syntaxdesugared:
New
for!
syntaxdesugared:
New
import
syntaxdesugared: