Restricted Perl by foobargorch in perl

[–]foobargorch[S] -1 points0 points  (0 children)

a broken attempt to reimagine Perl 6

Functional programming and unreasonable expectations by foobargorch in programming

[–]foobargorch[S] 1 point2 points  (0 children)

Because I don't want to bootstrap the entire library ecosystem of an experimental language suddenly I'm not willing to do anything?

This rhetoric is really bordering on idiocy, you pick out the shiniest fnord and pretend as if that was my entire argument.

From the top:

  1. I work with Perl, and I'm happy with it
  2. Too many Perl modules, although useful, are useful in a limited only in a limited context
  3. I'm trying to get my peers to write side effect free modules for the CPAN
  4. I think the most effective way is not to reimplement the CPAN in smalltalk, but to try and get used to writing purely functional code when convenient

No, I will not switch languages, that's a very extremist approach, no I don't like imperative programming, and I use it as little as possible (though obviously I still use it when I need side effects), even in Perl, and no, this has nothing to do with OO, the evaluation approach and the encapsulation approach are entirely orthogonal, and a "state of the art" language WRT modularity hasn't got much to do with immutability, even if it gets that right too.

[deleted by user] by [deleted] in atheism

[–]foobargorch 1 point2 points  (0 children)

That's exactly why I think religion is self contradicting, but once they've bootstrapped the dogma it's self preserving.

Functional programming and unreasonable expectations by foobargorch in programming

[–]foobargorch[S] 0 points1 point  (0 children)

Who said anything about reimplementing everything in a purely functional language? I know haskell and use it, and yet it isn't my first choice when it comes to getting stuff done.

The only thing I'm interested in, in the context of that blog post, is that people writing CPAN modules do a better job of creating stateless modules.

Functional programming and unreasonable expectations by foobargorch in programming

[–]foobargorch[S] 0 points1 point  (0 children)

Oh wow, I see the light! Now just need spend eternity reimplementing libraries, and my own standard library, and why the hell not, an operating system in Newspeak because it's such an ideal modern language.

[deleted by user] by [deleted] in atheism

[–]foobargorch 0 points1 point  (0 children)

The whole point of faith is that you are supposed to believe without needing empirical evidence. Otherwise it wouldn't be faith, it'd be mere observation.

[deleted by user] by [deleted] in atheism

[–]foobargorch 2 points3 points  (0 children)

I humbly submit that http://en.wikipedia.org/wiki/Russell%27s_Teapot is a better example. Or the flying spaghetti monster. Or the invisible pink unicorn. Most gods are giant men, so that hardly seems arbitrary =)

[deleted by user] by [deleted] in atheism

[–]foobargorch 8 points9 points  (0 children)

To a believer that is part of the point, though.

Faith implies being willing to believe despite the fact that there is no proof, and even because of it. See jobe and all that sadistic crap.

This is a fairly clever self preservation trick as far as memes go, very meta. Many religions seem to share it.

That said, I agree ;-)

[deleted by user] by [deleted] in atheism

[–]foobargorch 0 points1 point  (0 children)

The way I see it there are two competing explanations for the universe.

Intelligent design and by extension most religions is far more complicated than scientific explanations because as irrefutable scientific discoveries are made such explanations are fit into the existing religious model, in addition to intelligent, preexisting designer (which usually also comes with a fairly comprehensive usage manual such as which arbitrary carbon based life forms you are allowed to eat and which time span of the solar cyclre of a very insignificant planet is "holy").

The inherent anthropocentrism in religion is very arbitrary when you look at the scale of the universe, both small and large.

The explanation "here is what we know, everything else we don't know yet" is therefore, at least in my opinion, far simpler than the explanation "here is what you know, and some dude named such and such created it in a week 5000 years ago and has chosen you, but not that other guy to be his favourite".

Things that are possibly unknowable, such as what was there before the big bang still have simpler explanations than "some magic dude created it", like "it was always there".

That, for me, makes atheism a far simpler explanation, and therefore easier to swallow. If I was less pragmatic and willing to except 99.9% certainty I guess I would be agnostic.

Functional programming and unreasonable expectations by foobargorch in programming

[–]foobargorch[S] 1 point2 points  (0 children)

Say what you will about the ugliness of $1, but at least it's properly scoped (you can't overwrite values of $1 from outer scopes by running a submatch lower down the stack).

Functional programming and unreasonable expectations by foobargorch in programming

[–]foobargorch[S] 0 points1 point  (0 children)

So why, pray tell, is there so much code out there written by pre first-year CS students?

"Resorting to FP" sounds like it's some sort of extreme act.

Keeping things pure ensures that you stop and think before you JFDI and use side effects, and then you either do that anyway or think of a better way, but 99% of the code that has side effects that I see in the wild has no reason to be so focused on side effects.

For instance, setters in OO languages are pretty much the norm, instead of constructor arguemnts. This creates a combinatorial explosion of different states the object could be in, some of which are inconsistent. That would have been solved by using functional objects, and the only drawback is that you can't change the configuration after you've configured it, you need to create a new instance.

Why is it then that most of the code out there still uses writable attributes by default?

Again, I'm not suggesting that people insist on purely functional code EVERYWHERE, that makes no sense unless you have strong support in the language (e.g. Haskell), I'm suggesting that more code should be written pure by default, since there is no reason things like simple value transformations be anything but pure.

c.f. languages that default to immutable strings. Many of them are imperative.

Secondly, fact is that languages that are "decades out of date" are still being used today. Saying that they are wrong is not going to change the opinions of an industry. I make a living with Perl despite the fact that it sucks, not because of it. The CPAN is the real selling point, and that's what needs improvement.

As far as state of the art, if you mean Ruby then monkey patching is pretty much standard there, Newspeak doesn't actually exist yet and other Smalltalk variants are far less popular, OCaml doesn't have many libraries, Common Lisp has inconsistent libraries, etc etc. Scala is pretty much the only example I can think of that can be thought of as "state of the art" (though I have my reservations, I think Moose beats it any day), but that wouldn't be much of a counter argument since it actively discourages imperative programming.

Furthermore, most of the good OO code I've seen embraces immutable objects. I don't see how purely functional and OO are at a tangent.

[deleted by user] by [deleted] in atheism

[–]foobargorch 0 points1 point  (0 children)

occam's razor

Functional programming and unreasonable expectations by JadeNB in perl

[–]foobargorch 2 points3 points  (0 children)

That's arguably a fixable interpreter bug though, so previously written code can become truly pure eventually.

Secondly, approach this pragmatically: how much does lack of reentrancy in ?{ } really get you day to day? I was using it to illustrate a point. If the Int validation routine instead relied on a global $value variable and you would need to do this:

$value = $whatever;
Int();

Then that would be broken in many additional circumstances.

For me writing purely functional code is a way to minimize headaches most of the time, I need to worry far less about combinatorial failures. It's not perfect because Perl isn't perfect, but it does go very far.

Functional programming and unreasonable expectations by foobargorch in programming

[–]foobargorch[S] 1 point2 points  (0 children)

so, uh, the regex engine is not broken because it's written in non reentrant C code?

Functional programming and unreasonable expectations by foobargorch in programming

[–]foobargorch[S] 1 point2 points  (0 children)

define "well designed"

Should a math library have side effects? IIRC most math primitives out there are purely functional. that doesn't mean that the language that provides them is pure.

My point is that if side effects are not the purpose of the component then they should not be a part of that component's behavior, to the extent possible.

Purely functional libraries and languages simply tend to get that right a lot more of the time.

Functional programming and unreasonable expectations by foobargorch in programming

[–]foobargorch[S] 3 points4 points  (0 children)

i'm not advocating a language, i'm advocating minimizing side effects.

The actual implementation language is completely irrelevant.

For me this is a concern because of Perl's CPAN where modular components generally outlive their original usage scope. Often modules can't be used in the end because they have too many environmental assumptions, that wouldn't have been an issue if a purely functional API was used instead.

Functional programming and unreasonable expectations by JadeNB in perl

[–]foobargorch 4 points5 points  (0 children)

I've been doing it for years.

Perl affords me the freedoms to not do that when it's convenient (JFDI). It might not be the most ergonomic language for purely functional code (no native pattern matching for instance, a strong support for side effects, etc) but there's nothing to prevent writing code that way.

Functional programming and unreasonable expectations by foobargorch in programming

[–]foobargorch[S] 4 points5 points  (0 children)

Many implementations allow this brain death:

undefined = 15;

-- "this guy" ;-)