# from Tim Dysinger
# on Saturday 22 April 2006 11:17 am:
>(strongly-dynamically typed).
>I like that, but it seems that it makes it harder to write IDEs for
>such languages that can be helpful in such things as refactoring
>(because of things like not explicitly declaring the parameter class
>type in method declarations for example).
That, and the class of an object is not always known at compile-time
either. What exactly do you want from an IDE that would really save
you time in a language such as Ruby? You want a drop-down of all
in-scope variables that could be passed into a method? All methods
that could be applied to an instance?
Even an IDE that tries really hard to infer this stuff is going to have
trouble without actually running (or at least compiling) the code (and
that's a problem if only in terms of parsing up to where you are and
stopping -- though ruby's single-pass, ordered parsing simplifies this
over e.g. perl.) But, consider all of the bad things (tm) that could
happen when your editor runs off to compile someone else's code and
comes across something like a system call which executes at compile
time (sorry, I don't know a specific example as I'm not that up on the
internals, but start with: ruby -e 'puts "foo"; BEGIN { puts "hey"};'
and think your way through it from there.)
Back to more realistic examples: even the builtin types are going to
cause havoc. What is "a" when?
def sum_func(list, func)
t=nil
list.each {|i| t = t ? t+func.call(i) : func.call(i)}
t
end
a = sum_func([1,2,3.0], lambda {|x| x*2})
puts a
a = sum_func([1,2,3.0], lambda {|x| [x**2]})
puts a.join("|")
Should your editor try to flash "join" at you in red if you put it on
the first puts and not the second?
I posit that refactoring code-completion editors exist to assist in
grinding out the large volumes of ascii required to satisfy the
compiler of a strong/statically typed language. I've never really felt
like many of the up-to-40-odd characters in a typical method call could
be more efficiently placed by having the computer try to guess what I'm
thinking -- if I did, I would rethink my API, not look for an IDE. I
do occasionally wish that vim had a more elegant extension mechanism or
the ability to some things automatically, but even poking along at
10wpm with one hand while drinking coffee barely leaves enough time to
think where you're going before it is time to write the next line
anyway.
--Eric
--
Peer's Law: The solution to the problem changes the problem.
---------------------------------------------------
http://scratchcomputing.com
---------------------------------------------------
_______________________________________________
PDXRuby mailing list
[email protected]
IRC: #pdx.rb on irc.freenode.net
http://lists.pdxruby.org/mailman/listinfo/pdxruby