skaller wrote:
>> What's point-free style?
>>
Point-free style (sometimes called pointless style) is where you remove
or factor out free variables from functions. Example (in haskell notation):
1)
myAdd x y = x + y
myAddPointFree = (+)
2)
myAdd3 x = x + 3
myAdd3PointFree = (+ 3)
One thing that I like about haskell is that if you combine either the
"." operator (function composition) or the ">>=" operator (bind - for
monadic code) with point free style, you can get really succinct code.
I would just like to add one more comment: I believe John has commented
on the problems of haskell. I would just like to throw in my two cents.
John thinks that the biggest problem is portability, and by this I think
he refers to building the various libraries on different platforms.
While I agree that it is sometimes a pain to get haskell projects to
compile, I wouldn't say this is the most severe issue. As I see it, the
one issue that causes the most difficulty for a programmer of "standard"
background is _lazyness_. There's no doubt that in some cases it can
lead to wonderfully elegant code (search for dynamic programming in the
haskell cafe mailing list for an example) - but you'd be amazed at the
sort of silly and clunky problems you run into trying to bash strictness
into something as simple as reading a file. As much as I love some of
the features of haskell, I think this difficulty is simply unacceptable.
I'm not saying it's insurmountable: if you sat down and thought about
it, I'm sure you could work out ways to provide an easy syntax to get
around the problem. The issue is that the haskell community seems
hell-bent in outwitting each other, and certainly the rest of the
programming community. So they actually *prefer* code that has a high
barrier to entry. The other problem with haskell is monads - and the
thing is here again that it's such a great language feature. The problem
is just how you provide the syntactic sugar to make it feel seamless and
logical to the user, and here, again, haskell fails, in my opinion.
I come from a C++ background, and for while now I've been looking for
the "perfect" language. My wish list is:
- higher order functions, currying, closures, all that good stuff
- easy tuples, lists, and arrays (I would even like sets!)
- STRICT language - if I really need lazyness, I'll have to do a bit of
extra work. I would be willing to consider "hybrid" systems though:
haven't had any experience with them yet
- a good type system: sorry guys, here's where I think felix falls down
- the type system strikes me as quite hacky. The best candidates that
I've seen is the nominal (I know skaller won't like this!! ;-) vObj type
system in Scala, which strikes me as a nice combination of OO and FP,
and type classes a la haskell. But again, I think one really needs to
think about how to package the latter to make it intuitive to
non-functional programmers - I have some ideas on how to do this.
- more type system: inference, please! at the very least, type deduction
- monadic code: it would be cool to have a subsystem which is
essentially monadic, but that feels exactly like odinary imperative code
(a la ocaml). So as a programmer, you could write referentially
transparent code alongside imperative code. The only reason I think this
is interesting is that I think there should be a library a la MapReduce
which can automate the parallelization of code *assuming* that it is ref
trans. You could imagine an interface:
interface MapReducable =
pure foo :: Int -> Int
the "pure" bit would be a requirement on the implementor of
MapReducable, and the compiler would complain if the writer used
procedures that invoke actions from within.
- all the good stuff you guys are doing with threads, and fibres
- garbage collection
- a simple and elegant FFI library: the model here should be either
haskell (they've done a great job of this) or .NET - see for example
Fsharp and it's "pinning" method. Felix seems to do a great job on this,
but I think it went slightly overboard in attempting source
compatibility - you sacrifice some elegance in the type system and as
well it seems to complicate somewhat garbage collection.
- a simple syntax, with layout but the layout can be turned off: my
favorites are haskell and python. I love the way you look at haskell,
and you think you're looking at a mathematical derivation. I love that
when you look at python, you think you're looking at pseudo-code. On the
other hand, when I look at ocaml, I think I'm looking at road kill
(ducks for cover! ;-), all those let bla in let blabla in just drive me
nuts!!! Why not have
a = 1 -- let a = 1 in
b := 2 -- let b = ref 2 in
if a < b then
printf "Duh!"
else
printf "Eh?"
b := 1
a = 1 -- legal: new definition of a hides previous, just like "let"
statements
Sorry if this mail is rambling, and I apologize in advance for any
offending remarks: I don't mean to pick a fight here, I'm just outlining
what I would like out of a programming language.
thx
Martin
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language