Function application is Java already uses prefix notation. It just happens to wrap the arguments in parentheses for no discernible reason.
And for some reason, it doesn't think operators are functions.
Name:
Anonymous2009-02-08 13:01
>>9 And for some reason, it doesn't think operators are functions.
Java's not Scheme, where everything is a function.
Name:
Anonymous2009-02-08 13:43
>>10
Scheme's not Lambda Calculus, where everything is a function.
Name:
Anonymous2009-02-08 16:55
Prefix is for faggots, it's all about postfix.
Name:
Anonymous2009-02-08 16:57
>>12
It doesn't matter as long as it's consistent.
Name:
Anonymous2009-02-09 7:35
>>12
Postfix sucks:
- Variable arguments are needlessly complicated
- Practically requires a stack-based implementation, so it's more difficult to optimize code on typical systems
- Common constructs ('if', 'loop') either need to be written backwards (unintuitive), or require extra syntactic sugar or special cases in the parser (inflexible)
- Determining whether a given token is a function call or variable requires either a lookup table or extra syntax
- Program errors that disrupt the stack are easy to make and difficult to diagnose
With prefix notation, the only syntax necessary is a statement delimiter. This is a more than acceptable tradeoff for the tremendous gain in language flexibility, parsing is dead simple, because the first token in any given expression will always be either a function or a subexpression that resolves to one, and following tokens until the closing delimiter are its arguments.
Name:
Anonymous2009-02-09 8:39
>>14 Practically requires a stack-based implementation
Only if you allow functions with a variable number of input or output values. Which isn't really useful anyway (see your first point).
special cases in the parser (inflexible)
Unless you have parser macros. But I agree with the sentiment.
Determining whether a given token is a function call or variable requires either a lookup table or extra syntax
Variables and constants are conceptually functions that take nothing and return one value. E.g. in Factor: ( scratchpad ) [ 1 ] infer.
( -- object )
Program errors that disrupt the stack are easy to make and difficult to diagnose
Which is why you use a type system that helps you with that.
Anyway, I'm a Schemer because λ > SKI and naming things is the greatest thing ever.
Name:
Anonymous2009-02-09 9:34
>>15 Only if you allow functions with a variable number of input or output values. Which isn't really useful anyway (see your first point).
(+ 1 2 3 4 5) etc. isn't useful?
a type system
Now you have two problems.
Name:
Anonymous2009-02-09 10:13
I kinda like programming in RPL on my old trusty HP48GX, 4 bit crap and all...
Name:
Anonymous2009-02-09 10:26
>>16 (+ 1 2 3 4 5) etc. isn't useful?
It just doesn't fit the implicit argument passing paradigm. So it isn't useful in that context. The stack giveth and the stack taketh away.
Name:
Anonymous2009-02-09 15:10
(+ 1 2 3 4 5) etc. isn't useful? { 1 2 3 4 5 } sum is really that much more difficult?
PREFIX IS THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST, THE BEST