Few things II
Oskar Linde
oskar.lindeREM at OVEgmail.com
Thu Aug 9 03:30:55 PDT 2007
bearophile <bearophile wrote:
> I have changed the way I answer, hopefully this is better, now I group answers to a person.
This is much better, but I would still recommend you to reply to each
post(and person) in a separate message. Not doing that breaks the
message threading (the References header in your post will not refer to
the correct messages) making it much harder for others to follow the
discussion.
The web-news reader has lots of issues in itself, so I would really
recommend you to use an NNTP client if possible. Thunderbird seems to be
the most popular one.
> Sean Kelly:
>> Though I suppose a property method could be created:<
>
> Nice, I'll try that. But maybe a syntax like this one is simpler:
> myArray[1 .. 3].copyTo(2, 4);
This would also have the advantage of actually being implementable with
current DMD.
> BCS <ao at pathlink dot com>:
>
>> under the covers, yeild is a disaster IMO<
>
> Maybe this is true for a low level language, I don't know. But in Python it's very useful and quite commonly used (but I don't like its V.2.5 use for coroutines, it's too much confusing and its syntax is dirty because it looks like a statement used as an expression). It's used in C# too and it seem to cause no disasters :-) It avoids you to mess with the opApply.
yield would not be any worse than current opApply. In fact, it would be
identical on the low level side. To improve the low level side of this,
the compiler would have to be better at inlining and const-folding
delegate calls.
>> I usually make my own containers when the built in AA doesn't cut it, such as:<
>
> Designing and tuning a very good associative array/set requires months or years, so I was talking about the built-in one.
Many times people have been posting improvements to the built in AA. The
problem is proving that the improvements really are better for the
general case. The hardest part has proven to be defining the "general case".
>> I have implemented heaps of such functions too and I believe most people have implemented at least a few of those.<
>
> I am sure lot of people have done similar things, because when used (and not over-used) they can help (expecially if you are a bit used to functional programming). It's just I think I have implemented lot of them, and mine are probably more flexible (they usually accept arrays, AAs and iterable objects, more than one when possible, mixed types when possible, etc. There are some limitations that I have tries to push, some can't be removed) :-)
I have also made quite general functions and implemented iterator
versions for many of them too. I have really not had much time lately
(as in the last 10 months), but would still be interested to see your
code. There are quite a few new features in D since I worked on this
last that should make some things much easier now.
>> Is both much harder to read and parse (to me atleast) and also hard to indent in any meaningful way.<
>
> I think both versions aren't much readable (but the first is better), I suggest you to split your lines in more parts, so you can give those parts a name and you can comment the lines too.
Thank you for your comments on my personal coding style ;p.
Cheers,
--
Oskar
More information about the Digitalmars-d
mailing list