You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The original idea was that we'd be able to do this complete from the "outside", in userland, by providing a custom binder. (See #112.) That's still a possibility... but as a stepping stone we can simply model things in the implementation without exposing them in the language syntax, and then switching on the proper syntax in a 007-level module (which we can also fake as a pragma/flag initially).
I didn't include optional parameters in the list of things we should model, because when I think about it, an optional parameter is simply a parameter with a default None.
Also, worth keeping in mind that in the general case, a parameter default is a closure, not a value. The closure should close over the parameters declared so far.
Among the builtins,
prompt could benefit from having its msg parameter default to ""
substr could benefit from having its chars parameter default to self.chars
(showing that the parameter default ought to be a closure that closes on self)
I realize I would also like concat to be a builtin function (again), rather than a method on Array. The main reason is that I would prefer it to take a variable number of arrays (or rather iterables), and then it looks kind of lopsided to have it as a method on the first array.
The original idea was that we'd be able to do this complete from the "outside", in userland, by providing a custom binder. (See #112.) That's still a possibility... but as a stepping stone we can simply model things in the implementation without exposing them in the language syntax, and then switching on the proper syntax in a 007-level module (which we can also fake as a pragma/flag initially).
I didn't include optional parameters in the list of things we should model, because when I think about it, an optional parameter is simply a parameter with a default
None
.Also, worth keeping in mind that in the general case, a parameter default is a closure, not a value. The closure should close over the parameters declared so far.
Among the builtins,
prompt
could benefit from having itsmsg
parameter default to""
substr
could benefit from having itschars
parameter default toself.chars
self
)prefix
andsuffix
onStr
— see Make substr not have an optional argument #113 — though we might decide to keep them aroundsay
could benefit — aw, that'd be nice! — from having a slurpy parameterAs part of this, we might want to finally separate a
Parameter
type fromQ::Parameter
, which is a bit misplaced inSub
, to be honest. (Cf #253.)(I almost labeled this one "low-hanging fruit", but it might have unintended consequences, who knows.)
The text was updated successfully, but these errors were encountered: