Lang.NEXT panel (dfix)
Bruno Medeiros via Digitalmars-d-announce
digitalmars-d-announce at puremagic.com
Tue Jun 17 13:00:18 PDT 2014
On 17/06/2014 20:12, Jacob Carlborg wrote:
> On Tuesday, 17 June 2014 at 15:45:55 UTC, Bruno Medeiros wrote:
>
>> Adding "final" to every method in certain classes could be done
>> without semantic analysis. Reworking certain constructs to different
>> constructs possibly as well (for example change foreach_reverse to
>> just foreach usage)
>
> What about methods added via template and string mixins? You cannot add
> "final" to a method in a template, because you don't know if it will be
> mixed in into a class or struct (does the compiler allow "final" on
> struct methods?). There's no possible way to handle string mixins, a
> method can be built up by concatenating strings.
>
> --
> /Jacob Carlborg
Methods added through string mixins would not work. Actually, any AST
modification would probably not work through string mixins. That would
be an incredibly difficult problem to solve - in many cases, impossible
even.
And perhaps rightly so, one could make a case that string mixins should
be used sparsely? We have to realize that string mixins are very useful,
but are a dirty hack that is a replacement for AST macros.
As for methods added via templates, the tool would present the option to
add "final" to those templates as well, or just the class. If doing do
might break other classes that use the same template, well, that is a
problem that transcends whether this transformation is done manually or
by a tool. It would not be an issue with "dfix" itself then.
--
Bruno Medeiros
https://twitter.com/brunodomedeiros
More information about the Digitalmars-d-announce
mailing list