Schrift
[thread]11728[/thread]

OOP $self

Tags: Ähnliche Threads

Leser: 2


<< |< 1 2 >| >> 12 Einträge, 2 Seiten
KurtZ
 2008-04-30 18:42
#109040 #109040
User since
2007-12-13
411 Artikel
BenutzerIn
[default_avatar]
Hi

gibts eigentlich OOP-Module die es einem ersparen $self selbst auspacken zu müssen?
Der Aufwand nervt mich immens und bremst mich häufig mal schnell was OO hinzuskripten.

habe jetzt bei CPAN:Moose und CPAN:Class::Std dazu nix gefunden...

grüße
Kurt
TMTOWTDYOG (there's more than one way to dig your own grave)
KurtZ
 2008-04-30 19:01
#109042 #109042
User since
2007-12-13
411 Artikel
BenutzerIn
[default_avatar]
Quote
Perl has some real problems, though, as almost everyone will assert who has participated in large Perl programming efforts. Perl has OOP extensions, but they are non-obvious and laborious. I did enjoy learning Perl OOP because it taught me a lot about OOP itself and how to implement OOP in a language as a single hack. Writing Perl OOP, however, is no joy. Maintaining a large Perl source base is only possible with the highest level of discipline by the coders, and the language itself does not help enforcing correct coding practices.
...
What about Perl6?

Perl6 appears to have a lot of new features. Mostly, though, it is still vapourware. Meanwhile Perl, even in its version 5 incarnation, contains a lot of baggage. Even if it tries to provide functionality similar to Ruby, it will never be as clean.

I have more than five years of Perl under my belt and only one of Ruby. Coding Perl still makes me revisit syntax issues often and reread information on functions. With Ruby my experience is that going back to the manuals is a much rarer occasion. I don't expect Perl6 to change that.

->Ruby: Productive Programming Language (von 2002)
TMTOWTDYOG (there's more than one way to dig your own grave)
Struppi
 2008-04-30 19:19
#109043 #109043
User since
2006-02-17
628 Artikel
BenutzerIn
[Homepage]
user image
Wo liegt denn dein Problem?
Du brauchst auch in anderen Sprachen eine Instanz des Objekts, dank der flexibilität von Perl musst du diese halt bei jeder Funktion holen, andere Sprachen machen das intern mit this, aber mir ist kein Weg bekannt dies in Perl zu umgehen.
Relais
 2008-04-30 19:25
#109044 #109044
User since
2003-08-06
2246 Artikel
ModeratorIn
[Homepage] [default_avatar]
KurtZ+2008-04-30 16:42:35--
$self selbst auspacken zu müssen?


Was bedeutet denn das?
Erst denken, dann posten --
27. Deutscher Perl- u. Raku -Workshop (Termin wird noch gesucht) 2025 in München.

Winter is Coming
renee
 2008-04-30 19:27
#109045 #109045
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
KurtZ+2008-04-30 16:42:35--
gibts eigentlich OOP-Module die es einem ersparen $self selbst auspacken zu müssen?


CPAN:self, CPAN:selfvars
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/
Taulmarill
 2008-04-30 19:36
#109047 #109047
User since
2004-02-19
1750 Artikel
BenutzerIn

user image
Quote
Perl6 appears to have a lot of new features. Mostly, though, it is still vapourware.

Der Artikel aus dem das stammt ist von 2002. Damals hätte ich der Aussage evtl. zugestimmt. Mittlerweile sollten die aktuellen Entwicklungen um Pugs und vor allem Rakudo aber deutlich zeigen, dass tatsächlich Interpreter mit einem ernsthaften Umfang programmiert werden. Bis wir "das" perl6 1.0 bekommen wird es wohl noch ein wenig dauern, aber gut Ding will Weile haben.
$_=unpack"B*",~pack"H*",$_ and y&1|0& |#&&print"$_\n"for@.=qw BFA2F7C39139F45F78
0A28104594444504400 0A2F107D54447DE7800 0A2110453444450500 73CF1045138445F4800 0
F3EF2044E3D17DE 8A08A0451412411 F3CF207DF41C79E 820A20451412414 83E93C4513D17D2B
KurtZ
 2008-04-30 20:35
#109053 #109053
User since
2007-12-13
411 Artikel
BenutzerIn
[default_avatar]
Taulmarill+2008-04-30 17:36:43--
Quote
Perl6 appears to have a lot of new features. Mostly, though, it is still vapourware.

Der Artikel aus dem das stammt ist von 2002.

ja, aber ich wollte das Zitat nicht unnötig kürzen.... Datum hätte ich aber angeben sollen, korrigiere ich gleich!
TMTOWTDYOG (there's more than one way to dig your own grave)
KurtZ
 2008-04-30 20:41
#109054 #109054
User since
2007-12-13
411 Artikel
BenutzerIn
[default_avatar]
Struppi+2008-04-30 17:19:07--
Wo liegt denn dein Problem?

Programmieren hat viel mit Faulheit zu tun... (wenn ich da zitiere ist mir gerade entfallen)
TMTOWTDYOG (there's more than one way to dig your own grave)
KurtZ
 2008-04-30 20:46
#109055 #109055
User since
2007-12-13
411 Artikel
BenutzerIn
[default_avatar]
renee+2008-04-30 17:27:40--
CPAN:self, CPAN:selfvars

danke Renee, bei cpan statt google "self" zu suchen ist mir jetzt nicht gekommen, allerdings hätte ich doch gehofft dass die großen OOP-Module würden sowas vorsehen : (
TMTOWTDYOG (there's more than one way to dig your own grave)
KurtZ
 2008-04-30 20:53
#109056 #109056
User since
2007-12-13
411 Artikel
BenutzerIn
[default_avatar]
ich versuche gerade abzuschätzen wie performant der CPAN:self code ist ... kennt sich jemand mit CPAN:DB aus, das sieht doch nach overhead aus... die Notwendigkeit erschließt sich mir auch nicht.

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
sub _args {
    my $level = 2;
    my @c = ();
    while ( !defined($c[3]) || $c[3] eq '(eval)') {
        @c = do {
            package DB;
            @DB::args = ();
            caller($level);
        };
        $level++;
    }
    return @DB::args;
}


NACHTRAG: habs begriffen, danke!
TMTOWTDYOG (there's more than one way to dig your own grave)
<< |< 1 2 >| >> 12 Einträge, 2 Seiten



View all threads created 2008-04-30 18:42.