As a compiler writer I have a different opinion of what "syntactic sugar" actually is. To me, it's something that I can implement in the parsing and syntax tree generation phase.
That is, consider the stages Leaf uses to compile code:
Parse
Convert parse-tree into syntax-tree
Add types to syntax-tree
Lower to Leaf-IR
Lower to LLVM-IR
Emit target code
Anything I can implement in phases 1-2 is definitely syntactic sugar. It didn't require any changes in the langauge's abstract machine, or typing rules.
Some things in Step 3 I'd also consider syntactic sugar if they are plain rewriting rules. These are almost like parsing rules, but required a higher level of logic than the syntax tree conversion could do.
At a user level this would imply a feature that can be completely described in reference to other features or already existing concepts. It doens't add any new power or flexibility to the language. It certainly can make it nicer to use though.
As a compiler writer I have a different opinion of what "syntactic sugar" actually is. To me, it's something that I can implement in the parsing and syntax tree generation phase.
That is, consider the stages Leaf uses to compile code:
Anything I can implement in phases 1-2 is definitely syntactic sugar. It didn't require any changes in the langauge's abstract machine, or typing rules.
Some things in Step 3 I'd also consider syntactic sugar if they are plain rewriting rules. These are almost like parsing rules, but required a higher level of logic than the syntax tree conversion could do.
At a user level this would imply a feature that can be completely described in reference to other features or already existing concepts. It doens't add any new power or flexibility to the language. It certainly can make it nicer to use though.
As a not compiler writer in the slightest (or a compiler reader for that matter) this made perfect sense. Thank you.