Nushell core team meeting 2023-11-08

Attendees

  • Darren
  • Antoine
  • Ysthakur
  • Sophia
  • Stefan
  • Kubouch
  • WindSoilder

Agenda

  • invited ysthakur to discuss spread operator
  • errors as values
  • nu-parser
  • exec for windows has landed, but differently

Discussed Topics

Spread operator

https://hackmd.io/@ysthakur/nu-spread

Initial design questions

@ysthakur

  • Scoped: only inside list/records/ when calling commands
  • What to do with string as the operand of a spread?
    • e.g. python turns it into list like iterator
  • What could be potential restrictions

Kubouch:

  • I would like it in simple cases:
    • we have some preexisting commands
    • for the command calls it is tricky as we have some times type restriction and some times not. (parsing of rest list into sane parameters)
    • **kwargs in python would be tricky as we have both positional and keyword arguments mixed

Sophia:

  • How to spread mixed type lists
  • JS spreading strings feels yucky: what is the sensible unit to split on
    • don't spread strings
    • we have explicit commands e.g. split chars

Detour: destructuring pattern matching in assignment

https://hackmd.io/@ysthakur/nu-spread#Example-3

Q: how to handle errrors if pattern doesn't match. strong assumptions about what the parser returns

good starting point

  • spreading in list & record literals sounds straightforward
  • Complication in table literal:
    • should it spread to column/row
    • validation
  • call site would need some look into the type/checking
  • crawl/walk/run

Syntax

... used in existing ...rest params

.. for match => should probably change at some point for consistency in a separate PR

..$var can be confused with a range

Go with ... for spread

Errors as Values

Errors are behaving pretty much like exceptions (raise out if they are part of a pipeline, get caught by try/catch)

Could Errors be just a tagged version of a record -> destructurable (opposite of error make)

JT:

match $foo {
  error { msg, start, end } => {
    print $msg
  }
}
  • this would disfavour enum like error style internally: we don't have enums in Nu atm
  • error/codes link
    Kubouch: give this record in the closure args of the catch block
  • we currently pass the Value::Error which would immediately reraise taking it out of the argument
  • implement serialization and this would become usable

new-nu-parser

has been on the backburner but slow and steady we will move forward

exec for windows

  • unix side will still behave the same
  • IanManske, ChrisDenton, Darren workshopped how Windows works
    • behavior should follow how cargo solve the problem for win
    • Darren hopes that in the future we could replace a running nushell with the new version after an update

Issues

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
the issues which needs-core-team-attention

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
Note
to list all the PRs currently opened in nushell/nushell:

gh pr list --json url,number,author,title
| from json
| each {|i|
    $"- [($i.number)]\(($i.url)\) ($i.title) \(@($i.author.login)\)"
}
| reverse
| to text
Select a repo