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
I was working a bit on macro expansion - particularly quote (quasiquote) expansion with $ interpolations - and I've found that it's weird and inconvenient that we parse a.b into (. a (quote b)).
Specifically, the part that's weird here is that we emit (quote b) for the field name even though this is "not quote syntax": this should not yield a syntax literal during lowering, and is thus a semantic mismatch with actual quote syntax of the form :(a + b) or quote a+b end.
Q & A:
Why is this a problem? It means we need special rules to distinguish actual syntax literals from field names.
But can we really change this? Surely this AST form had a purpose? Yes! A long time ago Julia supported a.(b) syntax to mean getfield(a, b), which would naturally have been parsed as (. a b). However this was deprecated as part of adding broadcast syntax in WIP: implement f.(args...) as a synonym for broadcast(f, args...) julia#15032
I propose we just parse a.b as (. a b) with the second argument implied to be a field name.
The text was updated successfully, but these errors were encountered:
I wholeheartedly support the idea of parsing a.b as (. a b) - the old (. a (quote b)) syntax doesn't add anything in my opinion and needs to be special cased out downstream.
I was working a bit on macro expansion - particularly
quote
(quasiquote) expansion with$
interpolations - and I've found that it's weird and inconvenient that we parsea.b
into(. a (quote b))
.Specifically, the part that's weird here is that we emit
(quote b)
for the field name even though this is "not quote syntax": this should not yield a syntax literal during lowering, and is thus a semantic mismatch with actual quote syntax of the form:(a + b)
orquote a+b end
.Q & A:
a.(b)
syntax to meangetfield(a, b)
, which would naturally have been parsed as(. a b)
. However this was deprecated as part of adding broadcast syntax in WIP: implement f.(args...) as a synonym for broadcast(f, args...) julia#15032I propose we just parse
a.b
as(. a b)
with the second argument implied to be a field name.The text was updated successfully, but these errors were encountered: