Michel Fortin wrote:
On 2010-02-19 09:11:11 -0500, Andrei Alexandrescu <seewebsiteforem...@erdani.org> said:

If you could provide a list of silly named symbols that could be a dealbreaker for a prospective D user, please let me know. Thanks.

I don't think there are really any 'silly' names (except perhaps iota), it's just that many don't do exactly what you think they do on first reading.

The lengthy post below talks about _one_. If there are "many", you should be able to effortlessly list a handful.

For instance, the other day I was working with input ranges and needed a way to take N elements from the range and put them aside to work on them later. So I defined my own function "take" for that.

To me, "take" means you take one or more element and they aren't in the range anymore afterwards.

If you look at std.range, you'll find the same function 'take', but it does its job lazily. That's great, except when you don't expect it.

I'd contend that _you_ don't expect it. Others may as well think it's not copying, otherwise it'd be called "takeCopy" or "setAside".

At the end of the day you can't expect to fly blind through an entire library. "take" could be defined with a number of arguably good semantics. Phobos picked one. (By the way per popular request I reversed the order of arguments such that method notation works.)


Andrei

Reply via email to