Short list with things to finish for D2

Leandro Lucarella llucax at gmail.com
Thu Nov 19 12:47:07 PST 2009


Andrei Alexandrescu, el 18 de noviembre a las 20:33 me escribiste:
> Leandro Lucarella wrote:
> >grauzone, el 19 de noviembre a las 03:47 me escribiste:
> >>Does the current proposal make things simpler at all? All you're
> >>doing is to enable the programmer to "fix" the clumsy semantics by
> >>throwing lots of CTFE onto the problem. Why not generate the
> >>operator functions with CTFE in the first place...
> >
> >I was about to say that, the solution is a hack. I could understand a hack
> >if there were no other way to do it, but you can generate the code for the
> >opXxx using CTFE/string mixins already: we already have a hackish
> >solution. I don't think adding a new hack would be nice (specially when it
> >will be a big change).
> >
> >Maybe a not-so-hackish solution can be found when AST macros get
> >implemented.
> 
> I am thinking that representing operators by their exact token
> representation is a principled approach because it allows for
> unambiguous mapping, testing with if and static if, and also allows
> saving source code by using only one string mixin. It would take
> more than just a statement that it's hackish to convince me it's
> hackish. I currently don't see the hackishness of the approach, and
> I consider it a vast improvement over the current state of affairs.
> 
> I'd be grateful if you argued your point further and hopefully
> suggested an approach that is better. I want us to move fast with
> this. So it's just the right time to contribute.

What I found hackish about it is that the code is a string manipulation
mess. You can already do a string manipulation mess to programatically
implement all the operator overloading.

About the ideal solution, I don't have it. I just have the impression that
AST macros can help here, but it's been ages since they were postponed to
D3 and I don't have any idea of what they would look like, so I can't
propose a solution now.

But what the hell, maybe it's not so bad to have a better solution now,
even when not ideal.

-- 
Leandro Lucarella (AKA luca)                     http://llucax.com.ar/
----------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------
Los sueños de los niños son especialmente importantes en su etapa de
formación; si un niño no sueña es que será un pelotudo toda la vida.
	-- Ricardo Vaporeso



More information about the Digitalmars-d mailing list