proposed syntax change

Jarrett Billingsley jarrett.billingsley at gmail.com
Thu Aug 6 12:57:02 PDT 2009


On Thu, Aug 6, 2009 at 3:06 PM, Paul D.
Anderson<paul.d.removethis.anderson at comcast.andthis.net> wrote:
> I was browsing the Python spec yesterday and came across this interesting and useful syntax:
>
> "/" (one slash) means floating point division, e.g. 5/2 = 2.5 even though 5 and 2 are integers
>
> "//" (two slashes) means integer (floor) division, e.g. 5.0//2.0 = 2.0 even though 5.0 and 2.0 are floats.
>
> I've always been a little troubled by the standard division operator being dependent on the types of the operands. (I understand the need for it, I just didn't like it much.) Now here is an elegant (IMHO) solution.
>
> It seems to me that this could be added to D with very little effort and would add a feature to the language.

*snort* Nevermind breaking *all comments ever written*.

Yes, it would add a feature to the language.  Lots of things would.
Thanks for stating the obvious.

> Oh wait...I think "//" is used elsewhere. Well, we could still use it but mark it as a breaking change. Then users could simply remove all previous uses of "//" from their code. If they REALLY need to retain the old "//" functionality we could replace it with a new symbol. How about "--", like Ada? Oh wait...

It's at this point I really think you're joking.



More information about the Digitalmars-d mailing list