-
Notifications
You must be signed in to change notification settings - Fork 35
optional arguments #64
Comments
Basically, about the way of processing optional arguments, we have two options:
In the first approach, picrin would provide macros, known as The second approach is that we extend lambda's formals to take special keyword and succeeding expression(s) as a command for the lambda that it should process the arguments in certain range as optional arguments. This approach makes it very convenient to use optional arguments and rest argumets (and perhaps keyword argumets), but the compiliance gets appearantly decreased. |
let-optional example:
If you submit a piece of code of |
Rather than using |
Or, use |
I'm not so against to add |
R7RS requires |
No, it specifies but optional. |
Why are you not for the addition of |
You're discussing the addition of keyword objects. |
Hi,
I think
Yeah, I often feel like using keyword arguments or optional arguments when coding on picrin. But thinking about what keyword object enables us to do, I cannot figure out the real merits of using keyword objects in addition to symbol objects. I want rational explanation for that. You can use quoted symbols wherever you're using keywords.
As described above, I agreed keyword objects are very useful in most practial cases. But I won't supply that by the primitive operators. The implementation would be by scheme, not in C. |
You can find some documentation about Haskell's way of handling default parameters just by googling a little. Takes XMonad for example, they did default arguments using
In Haskell, as you may know, a record is an applicable object, and when he or she is applied with some of their field names and values, he or she returns a newly allocated record with the values of given field names updated with given values. That is, in the code above, -- this evaluates to a record, whose manageHook and layoutHook are
-- set to given values, and other attributes are of the values defaultConfig record holds.
defaultConfig {
manageHook = manageDocks <+> manageHook defaultConfig
, layoutHook = avoidStruts $ layoutHook defaultConfig
} This doesn't makes any extension against parameter passing style, even though it scales very well and looks so beautiful. |
I often want to define the function receiving optional arguments.
IMO, it is not necessary, but should be discussed.
How do you feel about it?
The text was updated successfully, but these errors were encountered: