Closed usaoc closed 6 months ago
This is ok with me.
An observation, and probably something you've already considered: If a macro implementation includes expose: $id ...
, then there's a chance that the macro could be made to do something strange with three identifies for id
where the middle one is as
. The right implementation of the macro would be to use expose: $id; ...
, I guess. This kind of subtlety shows up in a few places in Rhombus, and I don't know whether it's avoidable. At a minimum, we need to make sue that there's some way of reliably expanding, and separate groups provide that mechanisms for expose
.
I considered changing the grammar to expose: $id_or_rename_as; ...
, but I worried about the backward compatibility. I can apply the change if that wouldn’t be a big concern.
One more thing I considered and wasn’t so sure was whether the same support should be added to only
. I reckoned it wouldn’t be as useful, but it would be more consistent.
I applied the change and found three places where the expose: $id ...
form was used (none used more than one group), among which one place was in the import-macro docs.
The change to expose
caused no problems with any of my other existing code, and this seems ready to merge.
This works like a combination of
rename
andexpose
, which is not very common, but does appear to be used in the Rhombus codebase.Also change the grammar to disallow multiple names in a group in the multi-group form, to avoid confusion with the
as
form.