TODO: How to create wrappers around external commands? Allow extern
to have blocks:
foo(flag: true)
apply
command(requires const record and/or dynamic signature verification)
apply foo { flag: true }
(requires const record and/or dynamic signature verification)
bar ...$kwargs
}
Unpacking single flag: bar ...$foo
(such that it's compatible with Problem no. 1)
> def foo [...rest, ...--kwargs] {
print 'rest:' $rest
print 'kwargs:' $kwargs
}
> foo spam -x --foo --bar baz
rest:
0 spam
kwargs:
x true
foo true
bar baz
The "Functional call syntax" solution seems to me like the simplest method for passing flags around. The other methods based on record unpacking (apply
or ...$kwargs
) require either a const record, or dynamic signature verification.
Allowing arbitrary flags in signature also required dynamic signature verification. IMO it is not necessarily needed since you can pass a normal record around:
def foo [x: record] { ... }
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