(I moved this to meditations)

First of all your wording is dubious, (type)globs are only used with our package variables. Private variables with my don't have any type-globs. (which leads to some break in orthogonality)

The origin of type-globs (i.e. "things" with sigil * ) lies IMHO in Lisp, which has similar Symbol Tables.

Obviously it's possible to have separated name-spaces with sigils.

So are you asking to abandon sigils?

It's true that many think that using the same name aka symbol for different types is bad style.

But I see no way to stop using sigils in Perl, since all the context mechanics would stop working.

Any changes on that level would lead to a Perl6'ish compatibility mess (well probably even worse).

And * is needed for exporting functions into other namespaces.

HTH! :)

PS: Though I could imagine a pragma which automatically declares $xxx = \@xxx after a my @xxx (analogous for $yyy = \%yyy ), this would facilitate reference mechanics a lot. This pragma would automatically forbid name reusing (mostly) and referencing and dereferencing with \ and -> would become mostly unnecessary.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

update

I forgot to mention, every fancy feature comes with a price. In languages like JS or Python name-collisions are a quite common trap.

For instance if you assign to a variable list when the function/method list already exists.

And equally named nouns and verbs are quite common in English due to it's simplicity of grammar.° (e.g. compare noun Liste vs verb listen in German)

This is never a problem in Perl! $list will never collide with &list ....

°) a funnier example Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo


In reply to Re: Is glob feature really useful? by LanX
in thread Is typeglob feature really useful? by xiaoyafeng

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.