I wish I could use D for everything
Unknown W. Brackets
unknown at simplemachines.org
Wed Apr 29 20:04:43 PDT 2009
I'm lucky, I'm a technical lead/manager at work, so I get to say "for
this project, we're using D." And then it happens. Muhahaha. We're a
small shop but I enjoy my small amount of power.
Soon it will happen, just have to lay in the ground work. I know other
managers at my company have no problem with it, as long as we can find
other people who know the language it's less expensive to use D. That's
really the most important thing.
-[Unknown]
Steven Schveighoffer wrote:
> I've written this handy template in C# called DictionaryValueEnum. It
> returns an Enumerator for a Dictionary that enumerates only the values.
>
> The sole purpose of this enum is so I can have something reasonable when
> iterating through the values in a dictionary instead of:
>
> foreach(KeyValuePair<KeyType, ValueType> kvp in myDictionary)
> {
> ValueType vt = kvp.Value;
> ...
> }
>
> But of course, C#, like Java, has no free functions, so I have to
> encapsulate everything in a class, so my code looks like this:
>
> foreach(ValueType vt in DictionaryValueEnum.enumerate(myDictionary))
> {
> ...
> }
>
> Oh, how nice it would be to avoid all that crap and just type:
>
> foreach(vt; myDictionary)
> {
> ...
> }
>
> And I just typed about the 5 billionth time:
>
> if(ReferenceEquals(myObj, blah))
>
> Written in D would be:
>
> if(myObj is blah)
>
> I can't wait for D to take over the world, so I no longer have to write
> in this horrid language ;)
>
> -Steve
More information about the Digitalmars-d
mailing list