I'd love to see DScript one day ...
Ola Fosheim Grøstad via Digitalmars-d
digitalmars-d at puremagic.com
Wed Jun 15 03:08:41 PDT 2016
On Wednesday, 15 June 2016 at 09:40:39 UTC, Chris wrote:
> But factually I don't:
That's just because your example isn't realistic. A realistic
case in Python etc is where you accidentally assign when you
wanted to introduce a new symbol. That is not a typing issue.
A realistic D/C++ scenario:
import std.stdio;
// imported from libraries:
auto create_name(string n){
return ["PersonName",n];
}
auto create_name(const(char)* n){
import core.stdc.string: strlen;
auto slice = n[0 .. strlen(n)];
return slice.dup;
}
void main(){
auto myname = create_name("Ola");
writeln("Letter count: ", myname.length);
}
More information about the Digitalmars-d
mailing list