[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl5-porters
Subject:    Re: Garbage collection issues ("Segfault in functional streams")
From:       demerphq <demerphq () gmail ! com>
Date:       2006-04-30 7:34:30
Message-ID: 9b18b3110604300034n376c7dag564e37ee61b41239 () mail ! gmail ! com
[Download RAW message or body]

On 4/29/06, Christian <christian@pflanze.mine.nu> wrote:
> At 13:15 Uhr +0100 29.04.2006, Dave Mitchell wrote:
> >You are making this all *incredibly* over-complex.
>
> I don't if I want functional (referentially transparent) behaviour.
> Your code destructively modifies the array, so it's not referentially
> transparent (and it wraps around instead of ending at 0, btw). The
> functional programming paradigm including streams is not my
> invention; you may want to read about "functional streams".

I think people in the perl community are pretty familiar with
functional streams. Mark Jason Dominus wrote a very well received and
publicised book on the techniques called "Higher Order Perl". You
might want to contact the mailing list for the book with your
questions on this subject:  hop-discuss@plover.com

When I was reading your code I too thought you were overdoing things.
Its not necessary to write perl functional code in a lisp accent. Its
not necessary to fake Lisp nodes with arrays. If you end up with
problems like you have then its my opinion that they come from trying
to use Perl to do Lisp. If you restructure your iterators so they dont
end up making long chains of nested refs then the problems you have
experienced will go away. Simply because Dave didnt come up with an
exact equivelent to what you wanted doesnt mean its not possible and
doesnt mean that his advice isnt relevent.

I think if you snap out of the "I must have a CDR method and I must
have a CAR method and I must write this code as close to the way this
code would be written in lisp as possible" then youd find that Perl
allows you to enjoy all the functional goodness that you care to
employ.

Yves


--
perl -Mre=debug -e "/just|another|perl|hacker/"

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic