"::" as alias for "'" package qualifier 
Author Message
 "::" as alias for "'" package qualifier

I'd be interested in knowing if there is any background or precedent
for using "'" to implement namespaces.  I seem to recall that some
de{*filter*} (dbx or perhaps gdb) used to prefix variables with the
file where the variable was declared and "'" as a separator.  Apart
from that I can't think of any language precedent for this use of "'".
Does anyone know of any?

As to whether "::" should be made an alias for "'" in a package context --
I personally think "::" is more intuitive but I've programmed mainly
in C++ for the past 10 months, so I've gotten used to it.

Also, I've never really felt comfortable with packages and I've been
programming perl for at least 3 years. I just tend see quotes as a
way of delimiting strings and I find it harder to read perl which
makes heavy use of packages.  I think "::" is possibly a preferable
syntax since it is distinct from any other construct in the language
and is thus unambiguous and easy to read (and parse).
E.g. $abc::xyz{'efg'} as opposed to $abc'xyz{'efg'}.

(Actually, perhaps abc::$xyz{'efg'} is better... oops, I didn't say that :-)

Just my opinion...

---------
Paul E. Maisano
Australian Artificial Intelligence Institute
1 Grattan St. Carlton, Vic. 3053, Australia



Tue, 18 Jun 1996 09:05:20 GMT  
 "::" as alias for "'" package qualifier

:I'd be interested in knowing if there is any background or precedent
:for using "'" to implement namespaces.  

Ever looked at Ada?

--tom
--

      "Will Hack Perl for Fine Food and Fun"
        Boulder Colorado  303-444-3212



Tue, 18 Jun 1996 11:28:49 GMT  
 "::" as alias for "'" package qualifier

 Paul> from that I can't think of any language precedent for this use of "'".
 Paul> Does anyone know of any?

VHDL !

Just my 2 centimes (0.02 FF :-) to add to the confusion:

In Le_Lisp, a french dialect of Lisp, we had the notion of packages as well.
(with some object oriented extensions, like inheritance). The package delimiter
was ":". This could lead to nice things like

        (defun #:look:at:this:nice:identifier ()
                (let (it be)))

(note the leading #: defining the top level package, some sort of equivalent to
specifying main' in Perl)

Happy New Year!

--



Tue, 18 Jun 1996 16:31:14 GMT  
 "::" as alias for "'" package qualifier

Quote:


>:I'd be interested in knowing if there is any background or precedent
>:for using "'" to implement namespaces.  
>Ever looked at Ada?

Oh, a long time ago.

Hmmm, the "Language historians will also note some vestiges of" section
of the man page, could be extended to include Ada. And if :: is ever
introduced, perhaps C++ as well :-)

Happy new year to you.

---------
Paul E. Maisano
Australian Artificial Intelligence Institute
1 Grattan St. Carlton, Vic. 3053, Australia



Wed, 19 Jun 1996 09:03:03 GMT  
 "::" as alias for "'" package qualifier

:

:>:I'd be interested in knowing if there is any background or precedent
:>:for using "'" to implement namespaces.  
:
:>Ever looked at Ada?
:
:Oh, a long time ago.
:
:Hmmm, the "Language historians will also note some vestiges of" section
:of the man page, could be extended to include Ada. And if :: is ever
:introduced, perhaps C++ as well :-)

Multiply-inherited object methods in v5.0 buys us C++.

The current list of languages from which something or other was
derived includes at least the following.  See whether you can figure
them all out without help from Larry. :-)

    awk
    Ada
    Algol
    APL
    BASIC-PLUS
    C (K&R and ANSI)
    C++
    cpp
    csh
    emacs (gosling and stallman)
    fortran
    Lisp
    Pascal
    sed
    sh
    sort
    test
    tr
    troff
    vi

You may argue that COBOL contributes pictures, but it's not a strong
case considering "print using".

--tom
--

      "Will Hack Perl for Fine Food and Fun"
        Boulder Colorado  303-444-3212



Wed, 19 Jun 1996 23:57:14 GMT  
 "::" as alias for "'" package qualifier


Quote:
>The current list of languages from which something or other was
>derived includes at least the following.  See whether you can figure
>them all out without help from Larry. :-)
>    awk
...
>    vi

I'm still rather disappointed that Perl has learned nothing from 'icon'.
I did try Icon once, and use Perl extensively, but I still hanker for
what's not there - Perl is groping its way toward the fail/multiple
return paradigm, for instance, which gives Icon its strength.
If Ralph Griswold hadn't set his heart against including Regular
Expressions in Icon, things could have been different...

I do *not* want to start a Perl/Icon debate: I suppose just ask if
*nothing* has been learned from it. I suggest that iterators and the
growing habit of returning "undef" (='fail') might be.
Some input from APL might have been interesting, too...

Ian



Thu, 20 Jun 1996 05:18:59 GMT  
 "::" as alias for "'" package qualifier

:I do *not* want to start a Perl/Icon debate: I suppose just ask if
:*nothing* has been learned from it. I suggest that iterators and the
:growing habit of returning "undef" (='fail') might be.

I somewhat doubt that having undef as an OOB return value stemmed from
Icon.  I don't think that Larry knew Icon at the time.

:Some input from APL might have been interesting, too...



Hm....  :-)

It's sometimes a fine line between _ l_ e_ a_ r_ n_ i_ n_ g something from another language
and trying to turn Perl _ i_ n_ t_ o_  that language.

While Larry has for a long time wished that something like

    for $i (1 .. 10_000_000)

would not have to go through the roof on memory before it can start.
You could then also make
    for   (<>)
nor more expensive than
    while (<>)

And I've lately thought of having <$obref> be a way to do $obref->ITERATE().

But those deas are way down on Larry's priority list.  

--tom
--

      "Will Hack Perl for Fine Food and Fun"
        Boulder Colorado  303-444-3212



Fri, 21 Jun 1996 04:40:47 GMT  
 "::" as alias for "'" package qualifier

Quote:

>:I'd be interested in knowing if there is any background or precedent
>:for using "'" to implement namespaces.  
>Ever looked at Ada?

Ada doesn't use apostrophes to implement namespaces. It uses dot
notation to denote variables declared in the visible part of a
package, e.g. FOO.BAR for variable bar in package FOO. It uses an
apostrophe to denote compile time constants, called attributes in Ada,
e.g.  of enumeration types where you can write COLOR'FIRST to denote
the minimum value of the enumeration type COLOR.

        --jc

--
Juergen Christoffel, GMD        |  The best way to predict the future

Phone: send email instead       |       -- Alan Kay



Sat, 22 Jun 1996 04:22:54 GMT  
 "::" as alias for "'" package qualifier

:Ada doesn't use apostrophes to implement namespaces. It uses dot
:notation to denote variables declared in the visible part of a
:package, e.g. FOO.BAR for variable bar in package FOO. It uses an
:apostrophe to denote compile time constants, called attributes in Ada,
:e.g.  of enumeration types where you can write COLOR'FIRST to denote
:the minimum value of the enumeration type COLOR.

Right -- the point was that that it uses it for something other
than strings.  It reminds me of a method, in certain senses, so
&utmp'sizeof isn't too bizarre.

--tom
--

      "Will Hack Perl for Fine Food and Fun"
        Boulder Colorado  303-444-3212



Sat, 22 Jun 1996 06:46:55 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. "character class ""bug""

2. system(("cp", "-Rf", "/tmp/a/*", "/tmp/b")); doesnt wrk

3. how to parse a "this", "that", "and the ", "other" file

4. Can't call method "whatever" in empty package "whatever"...

5. Can't locate object method "bootstrap" via package "Crypt::DES"

6. Can't locate object method "new" via package "Win32::Eventlog"....

7. Can't locate object method "connect" via package "DBI"

8. Can't locate object method "Connect" via package "Mysql"

9. Can't locate object method "new" via package "MainWindow"

10. s"\n+$"" s"\n*$""

11. how to safely substitute a "(", ")" or "["

12. "perlfreak", "i love perl", "perllover" or...???

 

 
Powered by phpBB® Forum Software