Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calls to labeled functions and line continuation #101

Open
cspiel opened this issue Apr 16, 2018 · 0 comments
Open

Calls to labeled functions and line continuation #101

cspiel opened this issue Apr 16, 2018 · 0 comments

Comments

@cspiel
Copy link
Collaborator

cspiel commented Apr 16, 2018

Function calls to functions with labeled parameters cannot be
spread out over several lines.

Calls to un-labeled functions work ok as the following example demostrates.

iota(first, last, stride) =
        iter(a, x) =
                if $(gt $x, $(last))
                        return $a
                else
                        return $(iter $(array $a, $x), $(int $(add $x, $(stride))))
        empty[] =
        iter($(empty), $(first))

xs = $(iota \
           $(int 1), \
           $(int 10), \
           $(int 2)) # OK to use line continuations here.
printvln($(xs))

Calling labeled_iota on a single line also works, but spreading
out the call over several lines makes omake barf.

labeled_iota(~first, ~last, ~stride) =
        return $(iota $(first), $(last), $(stride))

ys = $(labeled_iota ~stride=$(int 1), ~first=$(int 0), ~last=$(int 4)) # OK: one-liner.
printvln($(ys))

zs = $(labeled_iota \
           ~stride=$(int 1), \
           ~first=$(int 0), \
           ~last=$(int 4)) # Bug: raises error 'keyword argument is required: last'!
printvln($(zs))

My more general wish is open parenthesis working is in many UN*X shells.
This is as long as at least one level of parenthesis is active line continuation
is implied and does not need to be specified via the backslash operator.

I can make that a separate enhancement request if desired.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant