Replies: 7 comments 18 replies
-
How would an example in this system have only one? How would the parser be able to distinguish between only an I notice in python, it has a specific marking for each. |
Beta Was this translation helpful? Give feedback.
-
Idea: With
Or it might look better without the comma in between:
|
Beta Was this translation helpful? Give feedback.
-
This syntax I can see one argument that |
Beta Was this translation helpful? Give feedback.
-
Summary from the meeting (feel free to add anything that I missed or got wrong) General
Interoperability & efficiency
Positioning
On syntax
Experiments
Other topics
|
Beta Was this translation helpful? Give feedback.
-
One of the problems we're running into with Looking at syntax patterns for a moment, the current design is that the pattern
binds
but this naming convention grates in a different way, because I'm trying to write a pattern that matches a sequence of individual Scheme macros-by-example resolev this tension by having `#'((f x) ...)` are not variables, but are instead pattern variables. I think we don't want to go back to a "variable" versus "pattern variable" distinction, but we could have a "sequence variable" concept that applies generally. That is,
would bind
In a template,
would similarly mean that a use of the This view would help resolve the question of what kind of contract goes on the argument, because the name
Also, note the difference between passing multiple arguments
and passing one argument that's a list
There are some details to work out here, such as how |
Beta Was this translation helpful? Give feedback.
-
Related to rest keyword arguments: rest patterns for pattern-matching on maps. I suggest
|
Beta Was this translation helpful? Give feedback.
-
@AlexKnauth has an implementation at #236 |
Beta Was this translation helpful? Give feedback.
-
This discussion is a reiteration of #66 (comment)
Currently:
...
syntax (I don't think this is documented yet?)make-keyword-procedure
from Racket.apply
andkeyword-apply
, both from Racket. These "argument objects" must appear in a restricted position. E.g., inapply
, the argument list can only appear at the end.The proposal is that keyword argument should be as important/easily used as regular argument. More concretely:
Since Rhombus has a syntax support for rest argument, it should have a syntax support for rest keyword argument too. This likely suggests that the current
...
notation might need to be modified to accommodate this change.Here's one possibility:
Here, the rest argument and rest keyword arguments are both independently optional. And when they are both missing, the rest section delimiter
:::
is optional as well.Note that rest keyword argument must take existing keyword arguments into account. I.e., it extracts the rest, just like how the rest argument extracts the rest.
(1) also suggests that there should be a single object representing a map from keyword to the corresponding value. In Racket,
kws
andkwargs
list are separated inmake-keyword-procedure
, which is unwieldy to work with.Note that Racket users have already done this, too. See https://docs.racket-lang.org/arguments/ by @jackfirth and https://docs.racket-lang.org/kw-utils/kw-hash_scrbl.html by @AlexKnauth. This suggests that this feature is highly desirable.
apply
andkeyword-apply
should be unified OR even better, entirely eliminated. Function application (with special syntax support) should suffice. For example, we can follow the syntax used in the definition site:Note that this particular syntax constrains us to have at most one argument object at the end.
Alternatives:
Python uses
*
and**
operators for converting argument objects to arguments, and allow them to be used multiple times. Thus, it doesn't have the "at most one argument object at the end" constraint.Alternatively, we can make the argument object contain both regular arguments and keyword arguments, just like https://docs.racket-lang.org/arguments/. Then, the current
...
in Rhombus could work out of the box. This would also be more ergonomic for a simple argument object passing. However, it may be more difficult to manipulate in more complex situation, and potentially less efficient.Concerns
To recap, there are three concerns.
Beta Was this translation helpful? Give feedback.
All reactions