Don't ask to ask, just ask | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
That's a perfect example of the sort of things that an expert Perl programmer can understand, but it's not welcoming to newcomers. It also has two serious bugs I see off the top of my head (and that's before parsing precedence, which I can't with that example). I agree, my bad. Care to elaborate about the bugs? I see that fib "5\n" would be allowed, so the matching should use \z; then, restrict to ascii via the /a modifier. Precedence is ambiguous (and it shows not to work as intended), so parens are necessary and that should be:
Something else? Of course, this is an acme example only given for showing "it can be done", but such constructs have poor maintainability - which is the entry point of your talk, I guess. I totally agree with you that good function signatures and an optional, gradual typing system would be great to have, for some style of programming. But looking the other way round, that would weaken a great strength of perl: Perl is amazingly good at being lousy at typing.</sarcasm>
For the sake of orthogonality, variable type constraints of course would need to be available for every kind of declaration. Currently, the function signature stuff misses that, but it can be done - not with core perl as you say, but with packages belonging to the core, e.g.
at the cost of lousy performance. On my machine, a fib(30) is
I'm far away and below of the current affairs and state of perl development/improvement, but implementing attribute handling in the core, type constraints via short-circuiting tie for common types (facilitating user-defined types) and allowing attributes for function signature variable attributes in the parser e.g.
probably implementing all that in XS first, would be a huge gain. There are some things I would wish to have in core proper apart from that and inlining via keywords (and modifiers where sensible):
but then, I should start to explore what is called perl 6, I guess, and many of these things surely have been discussed long ago.
perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'
In reply to Re^3: Recap: The Future of Perl 5
by shmem
|
|