|
yaoi prophet posted:I wrote that and mentioned it in one of the earlier perl threads, but I don't think I ever posted it. Let me see if I can dig it up. you could fix that if you were so inclined. instead of doing a substitution in the overload method, you could instead return a tie::scalar'd variable (of, say, a new Tie::Pirate). the FETCH method of Tie:Pirate could then be overloaded to something like this: code:
you can actually do some extremely goofy poo poo this way, as you can effectively modify any runtime behavior of perl you could possibly dream of. i wrote an example of some of this using an early version of PadWalker (which is even more powerful now, it looks like!) a long time ago: http://www.perlmonks.org/?node_id=316345
|
# ¿ Apr 3, 2008 21:47 |
|
|
# ¿ May 7, 2024 07:50 |
|
yaoi prophet posted:Of course, although tied hashes are actually a sane way to accomplish this sort of thing, whereas I was trying to come up with a hilariously inappropriate prank abusing one of the most wtf aspects of perl (being able to overload string literals). nono, you misunderstand. you overload AND tie. so your overload constructor looks like this: code:
quote:Edit: Sub::Sealed is pretty funny. Somewhere I have a module I wrote that will set UNIVERSAL::AUTOLOAD to a routine that will search for any semi-close matches for undefined subroutines that get called, including pawing through local directories for .pm files. Prank perl is the best. http://search.cpan.org/~davecross/Symbol-Approx-Sub-2.06/
|
# ¿ Apr 4, 2008 09:29 |
|
Sartak posted:It'll be my first YAPC, so I can't say for sure. But I am very excited about it. There are so many talks I want to see and people I want to meet. You should definitely come by. It's only $100. I think you'll get your money's worth. i noticed that they still have a few Perl6 sessions in the program. i mean, for christs sake, who the gently caress still cares about it? its been 8 years now!
|
# ¿ May 25, 2008 18:44 |
|
ashgromnies posted:One of my coworkers was on the original Topaz Perl 6 project and said that development changed a lot since then - they were making good progress and had a team that fit well together, but other influences changed things and I guess they scrapped a lot of work. oh man, topaz, i remember that. that was chip salzenburg's thing, wasn't it? last i heard he was locked up in jail or somesuch. i guess the bigshots in perl community have never had much luck with the law. if i remember right, topaz was just a rewrite of the perl 5 core in C++. the motivation was that new language features were too hard to implement due to the immense complexity of the perl 5 core. i just looked it up and that was NINE years ago. yeesh! i was just talking about the rewrite done with parrot. topaz was scrapped for parrot because larry and the community wanted a language rewrite in addition to an implementation rewrite. i remember working quite a bit on the first implementation of perl 6 on parrot for a few years - the one written in perl 5 that started after a half a dozen apocalypses or so had come out. it, unfortunately, collapsed due to its immense weight and the lack of developers holding it together. oh well. i also remember this book: Perl 6 and Parrot Essentials. i tech-reviewed both editions. i remember being so excited when it first came out! i thought that the book would drum up enough excitement and momentum in the community to finish the project within two years! the second edition came out four years ago.
|
# ¿ Jun 4, 2008 09:22 |
|
KillerTwinkie posted:Slight derail. the new regular expressions were definitely one of my favorite planned features of Perl 6 too. but minor syntactical changes aren't even the half of it! the best feature by far were "rules", which allow the programmer to build up complicated expressions in an object oriented way (inspired by Parse::RecDescent of course). i wrote up an article about em a few weeks after Apocalypse 5 came out (i.e. 6 years ago, LOL) that compares perl5 to perl6 in an example of parsing javascript code, if you're interested in learning more. http://www.perlmonks.org/?node_id=179555
|
# ¿ Jun 7, 2008 08:34 |
|
magimix posted:That's just a syntactic nicety. Same with how you usually don't need to include the quotes around a literal hash-key (e.g. $test->{'key'} vs $test->{key}). However, I've always preferred to keep dereferences 'explicit' by using '->'. I like the arrows syntactic niceties go a long way to keep your code from looking like line noise, especially when you're working with a structure thats more than a few levels deep.
|
# ¿ Jun 10, 2008 08:45 |
|
Cheesus posted:I don't share his sentiment. i've used Parse::RecDescent for a few projects in the past and it certainly is true that it is has significant performance drawbacks. as a good example: the grammar we used for the perl6 prototype involved a 1000-line BNF grammar that needed plenty of embedded code. when using it to compile a program there was a 30 second startup delay penalty during which Parse::RecDescent converted the BNF into an executable format (that internally used regexes to tokenize the input). that was reasonable for us since our prototype was not aimed at performance but at greatly simplifying the process of parsing a phenomally complex input files. for simple files, such as a logfile, you should be fine using more ordinary methods. BNF parsing will be, in general, much slower than a regular expression (which will be in turn much slower than unpack). the more complicated a parsing method can handle, the slower it'll be. the main question i have for your coworker then is: why do you need something more powerful than a regex for parsing a loving log file? and why do you need something more efficient? how big is this file, in the gigabytes?
|
# ¿ Jun 14, 2008 00:53 |
|
Cheesus posted:What's the best way to interface with a C++ library from Perl? depends what you're doing. Win32::Api, Inline::C (and Inline::CPP), and XS all offer different ways to interface with C++ with varying degrees of ease. if you don't want to do any post-processing, XS is probably your best bet of returning your data back to perl DIRECTLY as a hash, but if i were you i'd take a look at Win32::Api and Inline first. you can also use XS with Inline if you like what you see.
|
# ¿ Jun 26, 2008 10:15 |
|
Triple Tech posted:Is there anything inherently good/bad/better/wrong with passing things by reference and modifying them? I almost never do it, I always use return values. it depends how big your stack is, obviously! returning a new variable (essentially a copy of the data) is code-cleaner but more inefficent. its not too bad if your list is only a few thousand elements, but once you get into the millions and billions you won't really have that option. besides, indirect modification (either through references or pointers) is a pretty standard way to do things in many programming languages.
|
# ¿ Jul 10, 2008 00:14 |
|
checkeredshawn posted:Well, this isn't why I want to do it, but imagine I'd like to do something like printing "[array name] has contents: [array contents]". Why I really want to do it has something to do with the GetOpt::Long, I'll explain in more detail later if you want. you should be able to do something like what you want with a combination of Padwalker (http://search.cpan.org/dist/PadWalker/PadWalker.pm) and caller. just promise me you won't do something retarded with this! padwalker and the B modules are the perl equivalent of nuclear weapons. watch where you tread.
|
# ¿ Jul 31, 2008 23:22 |
|
German Joey posted:you should be able to do something like what you want with a combination of Padwalker (http://search.cpan.org/dist/PadWalker/PadWalker.pm) and caller. just promise me you won't do something retarded with this! padwalker and the B modules are the perl equivalent of nuclear weapons. watch where you tread. actually, looks like there's a new module that does EXACTLY what you want already called Devel::Caller (http://search.cpan.org/~rclamp/Devel-Caller-2.03/lib/Devel/Caller.pm) that uses Padwalker. how convenient. also, Padwalker has a new function called closed_over since i last saw it and i think those chumps borrowed from code that i wrote without giving me credit!!
|
# ¿ Jul 31, 2008 23:26 |
|
|
# ¿ May 7, 2024 07:50 |
|
Sartak posted:There's going to be another Frozen Perl in Minneapolis on February 7th. I'll be there. I've submitted a talk for Devel::REPL and Carp::REPL that will probably be accepted (though I won't find out until November 20th). i just looked at this and it seems like Carp::REPL owns. is there any chance that its pure perl?
|
# ¿ Oct 31, 2008 01:49 |