Thanks for the replies.
I have been comparing ansi c syntax and julia lately, so I had to naturally
ask, why julia doesn't define functions in the same way ansi c does?
foo(args...) begin # ansi c style definition
#some code
end
If julia would define functions like this, a *keyword for one line block*
(one line begin end) could be introduced, lets say '->'
You could then
foo(args..) -> args # one liner
(args) -> args # natural anonymous function
if true -> return x # one line if
These came onto my mind in first 10 secs, maybe there are *more* useful
cases.
But then I realised that this definition would clash with macros, because
you would have no more any function keyword.
So you would have to either
*(1)* make every callable with '@' in name a macro automatically
- In this case you would have to make a special case for macro definition
since right now, when compiler sees @foo, he tries to evaluate that. So the
special rule would have to be something like this
@foo(args...)begin ... end #macro definition, because block follows
(@foo(args...)begin ... end #not macro definition, because closed in (),
macro will be evaluated
@foo(args...) -> ... # macro def
(@foo(args...) -> ... # not macro def ...
*(2) *or make every callable both function or macro
- That's what I was asking about.
So that was basically my though process.
I guess my ideas were too simple as always so it would be not possible to
implement it anyway, even tho it looks kinda cool ( at least to me ). :)