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
updateI 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
|
|