8000 Null Safety / Null Coalescing plans? · Issue #77 · fubark/cyber · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Null Safety / Null Coalescing plans? #77
Open
@gnat

Description

@gnat

Really like what I'm seeing so far with cyber. Thank you!

Congrats on the big 0.4 release.

Any plans for implementing an ergonomic null safe operator (or safe navigation operator or equivalent)? Use case:

my test = [ 'hello':'world', 'blah':'blah']
my output = ''
output = try "$(test.hello)"
print output -- world
output = try "$(test.hello.missing)"
print output -- none ... Awesome! Easy.
output = try "$(test.hello.missing.goodbye)"
print output -- panic: Field not found in value.

Would be great to see Cyber handling missing nested items in maps with try/catch or ideally implement question mark operators (?? and/or ?. etc)

Why bother? https://www.youtube.com/watch?v=XIhQYRNBAYs

Related: https://en.wikipedia.org/wiki/Null_coalescing_operator
Related: https://en.wikipedia.org/wiki/Safe_navigation_operator

Proposal for Moonscript, which shares a similar syntax with Cyber: leafo/moonscript#285

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0