|
Ninjew posted:Perl supports closures, in that, if that variable is bound outside of that block of code, it is considered as a constant, not a variable, in that code. For example: I'm not sure what exactly you mean by "constant", but if you mean the value of the variable is fixed to whatever the value is at the time of the creation of the closure, it's not true: code:
floWenoL fucked around with this message at 11:44 on Oct 25, 2007 |
# ¿ Oct 25, 2007 11:40 |
|
|
# ¿ Apr 30, 2024 01:15 |
|
Ninjew posted:God, I love perl. No other language gives you the same kind of freedom to cheat and create very clever solutions to problems. Have a problem that would be best solved using a functional language like LISP? Just set no strict refs, and off you go! It is very refreshing to be able to actually program in a way that is not limited or constrained by the language. Don't listen to anyone who says that this flexibility is a negative aspect of perl, rather than a positive one. They are very wrong. You are equally wrong in painting Perl's flexibility (to say it in the best possible way) in a rose-colored light (mixing metaphors here). It's a double-edged sword, and frankly, the negative edge is bigger. I'm also not sure why you associate the behavior of "no strict refs" with functional languages, given that that is a feature shared by most, if not all, dynamic languages, functional or not. Edit: I like Perl, but let's not turn this thread into a wankfest.
|
# ¿ Oct 25, 2007 11:53 |
|
Triple Tech posted:1) How do you feel about Perl6? I saw a Google Video of Audrey's talk to a Japanese audience and it was pretty amazing. It was a really good presentation and I'm absolutely sold on Perl6. I'm a believer! I think if I knew more about what was required to contribute, I would. But I won't speak Haskellese or whatever. I saw Audrey's presentation live when she went to Amazon. There's some nifty stuff in Perl 6, but it's going to suffer from the same problem as Perl 5, but to a larger extent: to do any maintainable work you need to adopt a set of coding conventions (e.g., "Perl Best Practices") and resolve to only use a subset of the language. And this quickly gets ugly when you have to work with code from a different base (and different conventions and subsets of the language).
|
# ¿ Oct 27, 2007 01:24 |
|
Triple Tech posted:I have this new coding style I've adopted, and personally, I like it. But I'm pretty sure no one else is keen on it. What do you guys think? That's actually pretty cool. I'd rather have a 'return' explicitly in the last line of the block, though. Edit: Oops, do {} doesn't support return. :| floWenoL fucked around with this message at 22:30 on Oct 30, 2007 |
# ¿ Oct 30, 2007 20:22 |
|
heeen posted:^^ I think you don't even need do, wouldn't just curly brackets suffice? Yeah, that works, but you can do it a bit neater: code:
|
# ¿ Oct 30, 2007 22:32 |
|
tef posted:Here is a simple metric to evaluate coding styles: I disagree. His way reduces the time in which the variable is in an "invalid state", which arguably makes it clearer.
|
# ¿ Oct 30, 2007 22:35 |
|
ryan__ posted:It does appear to be a valid technique. I've seen several examples of it in perldoc and perl design patterns, but that doesn't leave me any less disgusted with it. He could(and should) accomplish the same task by a) writing it all on one line without the temp variables, b) returning an anonymous sub, c) branching into a normal sub. I don't understand the vehement reaction to this. Writing it all on one line is infeasible for more complex examples, the anonymous sub does the same thing but with more syntactic noise, and branching it off into a normal sub should only be done if the same code is used in multiple places or it does a distinct conceptualizable task. I can certainly see a whole page of do blocks if you're doing a bunch of distinct steps, each of which isn't worth decomping into a separate function.
|
# ¿ Oct 31, 2007 00:50 |
|
|
# ¿ Apr 30, 2024 01:15 |
|
Subotai posted:How do I get info about filesystems in Perl? There is a statfs call but no statvfs call, etc. Call df and parse its output? v:)v I'm sure there's a module like that in CPAN, too.
|
# ¿ Nov 11, 2007 07:31 |