On 2012-05-25 01:21, Araq wrote:
Nimrod is full of constructs that have inlining semantics and as such
declaration order matters quite a bit. The D compiler has/had bugs with
this feature for a reason. ;-)
I'm considering to weaken the requirement but I don't mind this feature:
Having the order reflect the call graph has its advantages too. Many
consider the resulting order *backwards*, but at least there is *an* order.
I don't know about Nimrod but in Ruby and I assume in other languages
like JavaScript, PHP and similar, the order of declarations only matters
at top level. Example in Ruby:
def foo (args)
bar(args)
end
foo(3)
def bar (args)
p args
end
Results in:
NoMethodError: undefined method ‘bar’ for main:Object
But if I wrap everything in a class the order doesn't matter:
class Bar
def foo (args)
bar(args)
end
def initialize
foo(3)
end
def bar (args)
p args
end
end
Bar.new
Prints '3' as excepted.
--
/Jacob Carlborg