Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
(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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (6)
As of 2024-04-24 12:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found