Remus

bearophile bearophileHUGS at lycos.com
Thu Nov 1 14:56:42 PDT 2012


Namespace:

> I see.
> My comprehension ATM is, that you want to concatenate two or 
> more strings at compile time, but this works fine: immutable 
> string test = "abc" ~ "def";

It's not a class of problems related to strings, it's quite more 
generic.


> Because of that it would be greatly helped if you can give me a 
> concrete example.

In D code I prefer to see variables/collections tagged as 
immutable/const. Look at your D code, at any D code. What is 
stopping you to tag all your variables in your D code as 
immutable?

According to the role of those variables in some cases this is 
not possible (or forces you to write recursive functions as you 
see in certain functional languages, that often in D I prefer to 
avoid for clarity and efficiency). But in many other cases it's 
possible with no loss of clarity and performance.

I'd like to increase the percentage of this second group. There 
are four of or more different kinds of situations where it seems 
possible to have immutables where currently you usually see 
mutables in normal D code (and keep in mind I am talking about 
possible or impossible. As I have explained it's more a matter of 
handy/not handy/nice enough ways to do it).

This is one of my two or three threads about this topic:
http://forum.dlang.org/thread/iosrld$5o8$1@digitalmars.com

Bye,
bearophile


More information about the Digitalmars-d-announce mailing list