Closed
Description
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 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#15032
I propose we just parse a.b
as (. a b)
with the second argument implied to be a field name.