Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Re: Re: Re: Teach him a lesson with facts

by hardburn (Abbot)
on Feb 23, 2003 at 05:16 UTC ( #237857=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Re: Teach him a lesson with facts
in thread Teach him a lesson with facts

why don't they think in a systematic way???

Perl is a very practical language. There are plenty of times where, reading the docs, I've thought "why did they do it that way?" Then when I got to actually using the thing, it suddenly saw that doing it that specific way made coding a lot easier, and said "Ahh, that's why it works that way!"

So if it doesn't appear systematic, it's only because we don't live in a systematic world.

Perl's OO is hacked

Yes, it is. But did you also know that adding OO to Perl required defining precisely zero new syntax to the language? Which brings me to this:

There is a delimer for Perl, because the original design of this language is flawed, you have to either radically modify it, or to keep it familiar but with lots of hacking.

Not needing any new syntax for OO is a direct counterexample to this. By the time people started looking for OO to be added to Perl, closures, lexically scoped variables, packages, and referances were already in the language. These things comprise the building blocks of Perl OO (and probably a few other things I can't think of ATM). I think bless() had to be added, but that's a builtin subroutine, not new syntax.

The so called perlish style does not agree with maintainability at all, hope we at least agree with each other on this.

Are you talking about obfu/golf? If so, you're looking at the wrong place. Nobody is (should) be writing Perl that way for real programs. Look around this site, for instance. The community here hates it when people post code that isn't using strict and warnings--two ideas that generally get in the way of obfu/golf.

It is perfectly reasonable to write Perl code that looks just as pretty as a well-formatted Java code. All that is needed is a few rules about identation and spacing (I prefer K&R, myself). Regexen can be ugly, but they're equally ugly everywhere, as Java programmers are sure to (re)discover, since 1.4 now includes them. The /x modifier can help, if used properly.

----
Reinvent a rounder wheel.

Note: All code is untested, unless otherwise stated

Replies are listed 'Best First'.
Re^5: Teach him a lesson with facts
by adrianh (Chancellor) on Feb 23, 2003 at 13:02 UTC
    But did you also know that adding OO to Perl required defining precisely zero new syntax to the language?

    I'm in a niggly mood :-)

    I don't know where this meme started - but it's not true. OO in perl needed little new syntax, but it did need -> method invocation, indirect object syntax and SUPER::.

    Adding OO to perl was done very neatly, so neatly many people didn't notice the difference - but there is specific syntax too support OO in perl.

      I don't know where this meme started . . .

      Possibly on page 321 of the blue Camel, just under the "Class Inheritance" subheading:

      As with the rest of Perl's object system, inheritance of one class by another requires no special syntax to be added to the language.

      The -> operator denotes a referance, which has plenty of use outside OO. In this case, were referancing a subroutine from a bless'd variable. I'm not sure about SUPER::.

      ----
      Reinvent a rounder wheel.

      Note: All code is untested, unless otherwise stated

        As with the rest of Perl's object system, inheritance of one class by another requires no special syntax to be added to the language.

        Inheritance didn't need extra syntax (it's just assigning to @ISA). Method invocation did.

        The -> operator denotes a referance, which has plenty of use outside OO. In this case, were referancing a subroutine from a bless'd variable. I'm not sure about SUPER::.

        Well, since references and OO came along in the same release you could argue that the syntax needed to be added for OO ;-)

        While the lexical item "->" is the same, the syntax for $object->method is different from $arrayref->[...], $hashref->{...}, etc. It needed to be added for OO (just as we got $coderef->(...) syntax added in 5.003_98 - as the result of a bet I seem to recall)

        While something like indirect object syntax was around in perl4 (witness print FILEHANDLE) I think it disingenuous to call it the same syntax as method $object and method Package - hacking of the parser was necessary.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://237857]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2019-11-20 19:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Strict and warnings: which comes first?



    Results (100 votes). Check out past polls.

    Notices?