DUB RC 0.9.24-rc.1 ready for testing
notna via Digitalmars-d
digitalmars-d at puremagic.com
Tue Jul 21 12:54:04 PDT 2015
On Tuesday, 21 July 2015 at 15:36:56 UTC, wobbles wrote:
> On Tuesday, 21 July 2015 at 14:59:21 UTC, notna wrote:
> [...snip...]
>> - make D2 easy2use for "not C++/Java/whatever gurus" again
>> -> all this different "types", which are either required as
>> an input for functions or are returned from those and need to
>> be casted/converted all the time... frustrating for real "new
>> comers"
> [...snip...]
>
> Huh? Whats frustrating about it?
> It's a statically typed language, there's always going to be
> "types".
> We have the 'auto' keyword for type inference though, which
> really makes it feel like a scripting language.
> Honestly, the biggest advice I can give to real new-comers is
> to use auto for a while till you get a feel for it.
I think you miss the point... maybe my confusing wording...
"auto" is fantastic, no doubt, but already not always
usable/working. I think there are plenty ppl out there, who want
to be sure what will be returned and prefer to specify the return
type they want/expect. And yes, again, I also like and use
"auto", as it can make life easy... or not... but only if I know
what will be returned or I just don't care (like for "write" and
friends) ;) And "auto" is a good example that auto-conversions
enhance the user experience, exactly what i want and try to
suggest/explain here...
What I say is, we should try to make the usage of "string" and
friends a comfortable no-brainer for all functions and by this
minimize the "cast|convert hell" by either having always all
functions accepting and returning basic types like [dw]char,
[dw]char[], string... or at least forcing the different range
types to do so. Just remember, most of the data out there is
still lines, strings, words and/or just a bunch of chars ;)
What i mean with the "cast|convert hell".. Just go to the Phobos
modules and check out how many casts|conversions are there... or
search the forum.dlang.org for threads which include the
suggestion to use the UFCS".array" hack ;) and so on...
example:
$ egrep -w
"to\!char|to\!\(char|to\!string|to\!\(string|cast\(char|cast\(string" -c datetime.d
43
or more general:
$ egrep -w 'to!|cast' -c *.d
array.d:52
ascii.d:9
base64.d:47
bigint.d:14
bitmanip.d:66
compiler.d:0
complex.d:1
concurrency.d:15
conv.d:176
cstream.d:8
csv.d:6
datetime.d:250
demangle.d:4
encoding.d:105
exception.d:29
file.d:21
format.d:125
functional.d:13
getopt.d:7
json.d:2
math.d:142
mathspecial.d:0
metastrings.d:0
mmfile.d:31
numeric.d:40
outbuffer.d:22
parallelism.d:34
path.d:19
process.d:24
random.d:31
signals.d:3
socket.d:85
socketstream.d:4
stdint.d:0
stdio.d:79
stdiobase.d:0
stream.d:72
string.d:98
syserror.d:1
system.d:0
traits.d:3
typecons.d:65
typelist.d:0
typetuple.d:1
uni.d:79
uri.d:27
utf.d:146
uuid.d:35
variant.d:57
xml.d:42
zip.d:44
zlib.d:28
I hope it's clearer now what I was trying to say before :O
More information about the Digitalmars-d
mailing list