exec
commandwhere
is now a parser keyword. Still uses the type-directed parsing code but that can be changed.How far do we want to go with meta-programming? IDE support gets harder the more we add
Jakub: don't want to do full parse-time evaluation, that would risk things like infinite loops in the compile stage. Hooks are currently a bit weird with the string evaluation thing, maybe we can improve on that.
Darren: votes to land a MVP so we can play with it
JT asks if anyone wants to brainstorm on the reverted exit code PR.
We haven't deprecated &&
and ||
for boolean logic yet, which makes it hard to start using those for Bash-like control flow. Would break existing Nu code in an ugly way.
JT: can we support this nicely without a deprecation stage? Do we treat internal false
as an error / nonzero exit code for the purpose of &&
and ||
?
Action item for Reilly: start an issue with a quick table of &&
and how it behaves, how we want it to work for internal values and external commands.
Jakub: do we want to revisit error handling more generally?
JT: we may want to think about truthiness and falsiness for everything, not just && and ||
a && b
in bash
print's a's output, then runs b if a's exit code is nonzero
if (^false) { ... }
JT thinks Jakub's on the right track with an incremental approach.
OTOH… do we want to do a parser rewrite from first principles?
Michael wonders if we can generate the parser from a grammar. Darren thinks that's not practical b/c Pest doesn't continue on errors, and tree-sitter has Rust integration problems.
Jakub: hard to integrate tree-sitter output into Nushell. That's why JT abandoned the nu-parser-2. We should keep pulling out parts of the parser incrementally, and separating the parsing and type-checking.
As a side project anyone who is interested in slowly moving the tree sitter grammar towards the way pest grammar currently parses would be the direction to go… Darren believes the Pest parser is around 90% there and that the tree sitter grammar is like 10%.
Independent of the numbers the pest grammar is a nice model to use to build out the tree sitter grammar.
We gotta do something; people keep asking for it. merelymyself submitted a PR but it wasn't quite right. windsoilder submitted a PR
windsoilder: parser has some limitations, doesn't parse unknown flags well. can't find a way to pass through
Darren: Dan has a hack on his Nushell fork where he makes every possible -
parameter (a-z,A-Z) a parameter. Don't want to do that exactly, but we could learn from it
Jakub: exec is a problem, because exec is an internal command. We need some solution for that - maybe we make exec a parser keyword. In general this is a tricky problem. Main takeaway: we can maybe break this into 2 subproblems for external and internal/custom commands.
Definitely something needs to be done.
or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Syncing