propose renaming Hash to Dict
flag
Messages 1 - 10 of 21 - Collapse all
/groups/adfetch?adid=htOkBhEAAADbQaarSvgiLR7oSOtJbN35nT3luubDeskUok6AUQ17nQ
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
1.  Darren Duncan  
View profile  
 More options May 31 2007, 8:10 pm
Newsgroups: perl.perl6.language
From: dar...@DarrenDuncan.net (Darren Duncan)
Date: Thu, 31 May 2007 17:10:57 -0700
Local: Thurs, May 31 2007 8:10 pm
Subject: propose renaming Hash to Dict
I decided to bring out this Hash->Dict topic in a different thread
from the thread on Synopsis r14407 about Object->Universal since I
consider them separate though tangential matters that should be
argued on their individual merits.

In the interest of that Perl data types are better off being named
primarily after their meaning rather than their implementation,
probably the current worst offender is Hash.

Barring some better name, I highly recommend/propose renaming Hash to Dict.

The term Dict (as a short form of "dictionary") is well understood by
general people and is the term used for associative arrays in some
other languages, so it is easy to learn, and easy to explain to
people in Learning Perl.

The term Dict is easier for new people to Perl, either new
programmers or visitors from other languages, to learn than Hash is.
It allows more self-documenting code where one is used.  And writing
Learning Perl should be easier.

For Perl 5 people, it should be very easy to adapt, or for the most
part they may not notice any difference save for documentation
references.

You also have equal huffmanization since the terms Hash and Dict are
both of the same length, and they are also equally easy to type.

And aside from the 4 letter word, all the other details associated
with hashes, eg the % sigil and {} constructor, and parts named
keys,values,pairs,kv et al can/should remain the same as they are.

In fact, since many users of Perl don't refer to the data type by the
name Hash but rather just by % or {}, the change may not take from
their useability at all or they may not even notice that a change
occurred at all, so easy to adapt.

Of course, if that change is made, KeyHash should be renamed to
KeyDict, and so forth.

After this change, the term Hash is then freed up to be used more
specifically to describe an implementation detail of something and/or
hashing functions et al.

I think this change would be a good thing.

Feedback is appreciated, either pro or con.

-- Darren Duncan


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
2.  Juerd Waalboer  
View profile  
 More options May 31 2007, 8:32 pm
Newsgroups: perl.perl6.language
From: ju...@convolution.nl (Juerd Waalboer)
Date: Fri, 1 Jun 2007 02:32:28 +0200
Local: Thurs, May 31 2007 8:32 pm
Subject: Re: propose renaming Hash to Dict
Dictionaries are usually alphabetically ordered. Hashes are not.
--
korajn salutojn,

  juerd waalboer:  perl hacker  <ju...@juerd.nl>  <http://juerd.nl/sig>
  convolution:     ict solutions and consultancy <sa...@convolution.nl>


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
3.  Chas Owens  
View profile  
 More options May 31 2007, 8:36 pm
Newsgroups: perl.perl6.language
From: chas.ow...@gmail.com (Chas Owens)
Date: Thu, 31 May 2007 20:36:40 -0400
Local: Thurs, May 31 2007 8:36 pm
Subject: Re: propose renaming Hash to Dict
On 5/31/07, Darren Duncan <dar...@darrenduncan.net> wrote:

> Barring some better name, I highly recommend/propose renaming Hash to Dict.

And lets rename Perl to Python. This is just change for the sake of change.

snip

> The term Dict (as a short form of "dictionary") is well understood by
> general people and is the term used for associative arrays in some
> other languages, so it is easy to learn, and easy to explain to
> people in Learning Perl.

snip

Dict also makes it sound like you are talking about pornography.  Of
course, hash makes it sound like you are talking about getting high.

snip

> The term Dict is easier for new people to Perl, either new
> programmers or visitors from other languages, to learn than Hash is.
> It allows more self-documenting code where one is used.  And writing
> Learning Perl should be easier.

snip

Please provide the peer-reviewed study that proves this as it goes
against my experience.

snip

> For Perl 5 people, it should be very easy to adapt, or for the most
> part they may not notice any difference save for documentation
> references.

snip

The Perl 5 people are already annoyed that . is changing to ~, sigils
are becoming invariant, etc.  Why not change the name of one of the
data structures too?  If we give them too many things to complain
about they won't be able to decide where to start!

snip

> You also have equal huffmanization since the terms Hash and Dict are
> both of the same length, and they are also equally easy to type.

snip

They may be the same number of characters, but I can type hash without
leaving the home row on QWERTY keyboards, I don't know about Dvorak.

snip

> And aside from the 4 letter word, all the other details associated
> with hashes, eg the % sigil and {} constructor, and parts named
> keys,values,pairs,kv et al can/should remain the same as they are.

snip

Right, because dictionaries have keys and values not terms and
definitions.  Of course, it all makes sense now.

snip

> In fact, since many users of Perl don't refer to the data type by the
> name Hash but rather just by % or {}, the change may not take from
> their useability at all or they may not even notice that a change
> occurred at all, so easy to adapt.

snip

Except of course those poor schmucks who foolishly wrote code like

if (ref $arg eq 'HASH') { ... }


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
4.  David Lloyd  
View profile  
 More options May 31 2007, 9:29 pm
Newsgroups: perl.perl6.language
From: lloy0...@adam.com.au (David Lloyd)
Date: Fri, 01 Jun 2007 10:59:45 +0930
Local: Thurs, May 31 2007 9:29 pm
Subject: Re: propose renaming Hash to Dict

<big snip>

I thought one of the things that Larry didn't want to do when moving
towards the next big version of Perl was to change the nature of the
language such that it wasn't Perl any more.

I feel that renaming a Hash to Dict would be one of those changes.

Personally, I don't find it difficult to discuss Perl hashes and a
computer science "hash algorithm" with people. One of the things I like
about Perl is that it doesn't presume that its coders are linguistically
impaired.

A Perl program's audience - imho - should be the programmers. That it
can run efficiently and well on a computer, again imho, is a side effect.

DSL


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
5.  Chromatic  
View profile  
 More options Jun 1 2007, 2:48 am
Newsgroups: perl.perl6.language
From: chroma...@wgz.org (Chromatic)
Date: Thu, 31 May 2007 23:48:37 -0700
Local: Fri, Jun 1 2007 2:48 am
Subject: Re: propose renaming Hash to Dict
On Thursday 31 May 2007 17:36:40 Chas Owens wrote:

> Except of course those poor schmucks who foolishly wrote code like

> if (ref $arg eq 'HASH') { ... }

I know you're teasing, but it *would* be nice to see that sort of code just
magically go away.

-- c


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
6.  Larry Wall  
View profile  
 More options Jun 1 2007, 12:17 am
Newsgroups: perl.perl6.language
From: la...@wall.org (Larry Wall)
Date: Thu, 31 May 2007 21:17:17 -0700
Local: Fri, Jun 1 2007 12:17 am
Subject: Re: propose renaming Hash to Dict
On Thu, May 31, 2007 at 05:10:57PM -0700, Darren Duncan wrote:

: I decided to bring out this Hash->Dict topic in a different thread
: from the thread on Synopsis r14407 about Object->Universal since I
: consider them separate though tangential matters that should be
: argued on their individual merits.
:
: In the interest of that Perl data types are better off being named
: primarily after their meaning rather than their implementation,
: probably the current worst offender is Hash.

Nope.  Hash is mostly about meaning, and very little about implementation.
Please don't assume that I name things according to Standard Names in
Computer Science.  I name things in English.  Hash is just something
that is disordered, which describes the associative array interface
rather nicely, distinguishing it from the ordered Array interface.
The fact that it *might* be implemented using a hash algorithm is
merely a nice association with some mnemonic value for CSish folks.

Likewise, if I say Object I'm referring not to a CS object so much as
an English object, which is just something that is fairly discrete
and can be handled and treated as a single thing, even if it happens
to contain multiple things.  About the only nod to CS here is that
you can call the .HOW method on any Object.  Anything beyond that
is the fault of the metamodel.

In general I'm much more interested in the natural linguistic feel
of Perl than in matching up with any particular standard CS terms.
That's why you have "given" and "when", not "switch" and "case".
That's why you say "next" and "last", not "continue" and "break".
That's why we have "state" rather than "static", "my" rather than
"var" or "decl", "contend" rather than "atomic", "maybe" rather than
"orElse", "has" rather than "attr", "role" rather than "interface",
and so on.

Of course, it's possible to pick words that have too much overloading
in the CS literature, but I don't think either Hash or Object really
fall into that category, in the case of Hash because hash algorithms
are a fairly minor thing, and in the case of Object because people are
already used to all different kinds of Object systems, some class-based,
some prototype-based, so generalizing to a kind of object that gives
you both is not really a problem.

And as I said before, part of the reason for using Object is political,
because it means we're Really Doing Real OO™.

And maybe part of the reason for *not* using Universal is also
political, insofar as Perl 5's UNIVERSAL has been sorely abused in
various ways, and I don't want people to have that mental association.
(Kinda like the fact that Captures resemble anonymous typeglobs but
we're *not* going to call them that...)

Larry


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
7.  Darren Duncan  
View profile  
 More options Jun 1 2007, 1:39 am
Newsgroups: perl.perl6.language
From: dar...@DarrenDuncan.net (Darren Duncan)
Date: Thu, 31 May 2007 22:39:19 -0700
Local: Fri, Jun 1 2007 1:39 am
Subject: Re: propose renaming Hash to Dict
At 9:17 PM -0700 5/31/07, Larry Wall wrote:
>Nope.  Hash is mostly about meaning, and very little about implementation.
<snip>
>And as I said before, part of the reason for using Object is political,

<snip>

Okay, thanks for addressing these 2 naming concerns I talked about;
I'll drop the associated matter now. -- Darren Duncan


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
8.  Thomas Wittek  
View profile  
 More options Jun 1 2007, 5:44 am
Newsgroups: perl.perl6.language
From: m...@gedankenkonstrukt.de (Thomas Wittek)
Date: Fri, 01 Jun 2007 11:44:53 +0200
Local: Fri, Jun 1 2007 5:44 am
Subject: Re: propose renaming Hash to Dict
Larry Wall:

> Nope.  Hash is mostly about meaning, and very little about implementation.
> Please don't assume that I name things according to Standard Names in
> Computer Science.  I name things in English.  Hash is just something
> that is disordered, which describes the associative array interface
> rather nicely, distinguishing it from the ordered Array interface.

Hm, but with which would you explain a "hash" in plain english?
What would be the closest equivalents in the real world?

I'm not a native english speaker, but I've never heard or read the word
"hash" outside CS.

I guess this ones are close:
- collection (contra: doesn't imply the access to an item)
- dictionary (contra: might be assumed ordered)
- directory (contra: might be assumed ordered, clashes with a file
directory)
- index (contra: might be assumed ordered, might be too technical)

The problem with the implication of an order in the real world concepts
is that you probably won't find one that isn't ordered.
Those things allow us to find something easily by a word. But as we
first have to find that word, we have an ordered list of the words...

So there is no perfect candidate in the above list.
But in my opinion they are still more "english" than "hash".
Additionally I believe it would be easier to learn that it's (e.g.) a
dictionary that just is not ordered than learning a whole new word like
a "hash" (which it was for me as a non-native english speaker).

--
Thomas Wittek
http://gedankenkonstrukt.de/
Jabber: streawkc...@jabber.i-pobox.net


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
9.  Daniel Hulme  
View profile  
 More options Jun 1 2007, 6:44 am
Newsgroups: perl.perl6.language
From: mas...@istic.org (Daniel Hulme)
Date: Fri, 1 Jun 2007 11:44:49 +0100
Local: Fri, Jun 1 2007 6:44 am
Subject: Re: propose renaming Hash to Dict

On Fri, Jun 01, 2007 at 11:44:53AM +0200, Thomas Wittek wrote:
> Larry Wall:
> > Nope.  Hash is mostly about meaning, and very little about implementation.
> > Please don't assume that I name things according to Standard Names in
> > Computer Science.  I name things in English.  Hash is just something
> > that is disordered, which describes the associative array interface
> > rather nicely, distinguishing it from the ordered Array interface.
> I'm not a native english speaker, but I've never heard or read the word
> "hash" outside CS.

I suppose that as a non-native English speaker you've never eaten
"corned beef hash". I quote from Wikipedia:
"Hash is a mixture of beef (often leftovers of corned beef or roast
beef), onions, potatoes, and spices that are mashed together into a
coarse, chunky paste, and then cooked, either alone, or with other
ingredients."

It's a bit of a working-class dish, for using up your leftovers, so not
the sort of thing you'd eat as a tourist, but it seems many other
countries have the same sort of thing: using your leftovers is a pretty
universal need.

In colloquial English there's also the expression, "to make a hash of
something," which means to make a mess of it, to screw up.

That said, the dish and the idiom are both dying out, and the current
generation of school leavers might not have heard of either. I didn't
make the connection until Larry described it as being "disordered".

As a general point, I think it's pretty easy to make a mental
distinction between a 5ish hash and a hashtable, just as it's easy to
remember that 5's abstracted lists and arrays aren't the same concepts
as linked lists and C-style concrete arrays.

--
"It must be accepted as a principle that the rifle,  effective as it is,
cannot  replace  the effect  produced  by the  speed of  the horse,  the
magnetism of the charge, and the terror of cold steel."                
  -- British Cavalry training manual, 1907 ::: http://surreal.istic.org/

  signature.asc
< 1K Download

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
10.  Thomas Wittek  
View profile  
 More options Jun 1 2007, 12:05 pm
Newsgroups: perl.perl6.language
From: m...@gedankenkonstrukt.de (Thomas Wittek)
Date: Fri, 01 Jun 2007 18:05:58 +0200
Local: Fri, Jun 1 2007 12:05 pm
Subject: Re: propose renaming Hash to Dict
Daniel Hulme:

>> Larry Wall:
>>> I name things in English.  Hash is just something that is disordered

>> I'm not a native english speaker, but I've never heard or read the word
>> "hash" outside CS.

> you've never eaten "corned beef hash".

To conclude, as hash definitely tastes better than a dictionary, we
should stick to that name. ;)

At least nobody can say that Perl is bad taste!

--
Thomas Wittek
http://gedankenkonstrukt.de/
Jabber: streawkc...@jabber.i-pobox.net


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google