ch-ch-changes

Bill Baxter wbaxter at gmail.com
Wed Jan 28 15:06:43 PST 2009


On Thu, Jan 29, 2009 at 7:38 AM, Yigal Chripun <yigal100 at gmail.com> wrote:
> Bill Baxter wrote:
>>
>> On Thu, Jan 29, 2009 at 5:31 AM, Yigal Chripun<yigal100 at gmail.com>  wrote:
>>>
>>> Bill Baxter wrote:
>>>>
>>>> On Wed, Jan 28, 2009 at 6:07 PM, Nick Sabalausky<a at a.a>   wrote:
>>>>
>>>>> Isn't "tail" the standard counterpart to "head"? ("toe" just doesn't
>>>>> sound
>>>>> good)
>>>>
>>>> Tail has a history of being used to mean "everything but head" in
>>>> functional programming languages like Haskel and ML.
>>>>
>>>> So of  back, last, end, tail, rear, foot, toe, it seems every one has
>>>> some strike against it.
>>>>
>>>> back - could be mistaken for an action
>>>> last - doesn't pair well with "head", and "first" sounds too much like
>>>> item #1 overall
>>>> end - in C++ usually means "one past the end"
>>>> tail - in FP langs means "everything but head"
>>>> rear - makes Walter thing unhappy thoughts
>>>> toe - sounds silly, doesn't make so much sense for a range that
>>>> represents a tree structure.
>>>>
>>>> Toe is sounding pretty ok.
>>>>
>>>> Actually I think the critique that it doesn't make sense for a
>>>> non-linear range should be thrown out.  Linearizing is the whole
>>>> purpose of a range.  So even if it wasn't linear before, a range
>>>> effective is providing a linearized view of it.
>>>>
>>>> So that leaves "it sounds silly", which is a pretty weak subjective
>>>> argument against.
>>>>
>>>> --bb
>>>
>>> I disagree with the above reasoning. "Language X has different meaning
>>> for
>>> word Y" is not a valid argument IMO. One of D's stated goals is to break
>>> backward compatability when needed in order to get a better language
>>> design,
>>> yet we constantly keep getting back to " but in C++ ...".
>>> if people want to use a backward compatible language they already have
>>> C++
>>> for that, and they don't need D. I for one, prefer to change when the
>>> change
>>> makes sense and brings more clarity. Yes, it'll be initially confusing
>>> for
>>> former C++ programmers, but IMO it's worth it in the long run.
>>> head/toe is not just silly, it's also non intuitive for non-English
>>> speakers. (I'd be confused by this, had i seen this for the first time)
>>> When I write D code I think in D, not any other language and I'm sure
>>> that
>>> applies to most people. making the switch to "D mode" is easier IMO than
>>> trying to remember confusing terms, just because some other language has
>>> slightly different meaning for the deafult terms.
>>>
>>> Hack, I don't even know haskel, why should I care about haskell's
>>> definitions?
>>
>> If you port code from C++ or Haskell to D it will become an issue.  I
>> ported a largeish C++ library with lots of iterators and it was only
>> natural to use the same terminology as C++ there (begin/end).  If D
>> co-opted those terms I'm not sure what I'd call the ported C++ ones to
>> differentiate, and it would just end up being confusing to both D and
>> C++ users.  I think making it easy to port C++ code is a good goal.
>>
>> Not so sure about Haskell, though.  D may never be functional enough
>> for porting Haskell to make much sense.
>>
>>> I already asked in a previous post - would a chinese programmer
>>> intuitivly
>>> think that toe is the last item in a range?
>>
>> Does it really matter if it's used everywhere and consistently
>> throughout D?  It's like saying "char" is unintuitive.  Yeh, it is
>> unintuitive, but once you know it's short for "character" it's easy to
>> remember.  Surely a Chinese programmer once he learns toe is the last
>> item will have no problem remembering what it means, given the
>> relationship between head and toe on a person's body.
>>
>> --bb
>
> I guess you completely missed my point.
> If we are choosing terms that are going to be used everywhere and
> consistently throughout D, we should pick the intuitive words for the first
> and last items in a range - 'first' and 'last'.

No I didn't miss your point.  I don't think anyone has said anything
against "last".  Last is a great word, and comes with no conflicting
baggage.  But "first" does have baggage.  It so strongly suggests that
it is item #1 that it would seem odd to say .next and still be looking
at the first item.  That's the argument anyway.   Realistically, I
think there are about 5 reasonable word pairs we could choose, and all
of them have something against them, but any of them would work.

> to rephrase what you've said:
> Surely a C++ programmer once he learns 'last' is the last
> item in a D range (simple, isn't it?) will have no problem remembering what
> it means.
> in other words - if a Chinese programmer can learn an unintuitive term so
> can a C++ programmer. the only difference is that with the former option we
> all get stuck with a bad name for good, while with the latter it's only a
> temporary inconvenience since [hopefully] the C++ programmer will become a D
> programmer.

"Last" is perfectly fine.  It's "first" that's got issues in that pair.

> as already pointed by others [read Chad's reply] - there is no relationship
> between head and toe on a person's body, and you might as well use 'foot'.

Yep, foot would be ok too.  But toe is one letter shorter.

> regarding porting code - while I agree that this can help, porting code is a
> minor and secondary objective. both C code and a subset of C++ (in D2) can
> be directly linked with D code, so porting isn't that important and isn't
> the main goal of the language. besides, your argument would apply to most
> other C-family languages - there's a lot of Java code ported to D, for
> example, so maybe we should prefer Java's semantics over the C++ ones?
> or maybe C#'s or javascript, or ..?

I just don't know what the conventions are in those other languages.
If there are such pre-established conventions in those languages, I'd
like to know about them and take them into consideration as well.
Java at least, given it's popularity and the large opportunity for
porting Java code to D (e.g. DWT).   But my impression is that Java
uses fairly different conventions for iterators that don't really
conflict with any of the current proposals on the table.

--bb



More information about the Digitalmars-d mailing list