Closed ktodyruik closed 8 years ago
The grammar of C# isn't friendly to allowing people to define new operators, particularly words. For example, if we wanted to add a with
operator, we'd run into ambiguity since a<b> with (x: y)
is already a valid expression in C#. (EDIT: EC# does have a backquote operator though, so you could write a<b>
with(x: y)
) Also, since LeMP is a lexical macro processor, macros can't make decisions based on the types involved, which may be a problem.
That said, I already solved this problem from another angle. If you use the new ADT macro in LeMP, you get immutable types with free "With" functions to make changes easily.
Could loyc macros implement concise immutability syntax (fsharp style) in c#? Including 'with' to make changes easily to immutable types?