# Code completion for Ruby - Net Beans, RDT, and more

**URL:** <https://www.ruby-forum.com/t/code-completion-for-ruby-net-beans-rdt-and-more/89816>\
**Category:** Ruby\
**Created:** [March 22, 2007, 10:40pm UTC](https://www.ruby-forum.com/t/code-completion-for-ruby-net-beans-rdt-and-more/89816 "2007-03-22T22:40:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![robertjames](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e9c0ed/32.png) [@robertjames](https://www.ruby-forum.com/u/robertjames)\
**Post date:** [March 22, 2007, 10:40pm UTC](https://www.ruby-forum.com/t/code-completion-for-ruby-net-beans-rdt-and-more/89816/1 "2007-03-22T22:40:42Z")

</div>

Code completion for Ruby is on its way. I’m concerned that the  
recently popular style of using hashes to fake named params will keep  
us in the dark, though.

And anyway, Ruby wants to get named params. How about this: declare  
the method explicitly:

def parse(filename, char = nil, conn = nil, another\_param = nil)

and have the interpreter allow the style, by converting a final hash  
to params if and only if all of the keys match the arg names.

So:

parse(‘readme.txt’, :char =\> ‘a’, :another\_param =\> true)  
becomes  
parse(‘readme.txt’, a, nil, true)

whereas  
parse(‘readme.txt’, :bad\_param =\> ‘b’)  
would still be  
parse(‘readme.txt’, {:bad\_param =\> ‘b’})  
and it would be up to the parse method to handle as it normally does.

This would allow:

- real named params
- more explicit method definitions
- code completion
- preserve the current style

---

<div class="post-metadata">

**Author:** ![robertjames](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e9c0ed/32.png) [@robertjames](https://www.ruby-forum.com/u/robertjames)\
**Post date:** [March 22, 2007, 11:21pm UTC](https://www.ruby-forum.com/t/code-completion-for-ruby-net-beans-rdt-and-more/89816/2 "2007-03-22T23:21:22Z")

</div>

Right - I should clarify - my goal is to allow easy migration of all  
of the current libs that use option hashes.

With the syntax I’m suggesting, library owners could change their  
method definitions, and not break older code.

---

<div class="post-metadata">

**Author:** ![robertjames](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e9c0ed/32.png) [@robertjames](https://www.ruby-forum.com/u/robertjames)\
**Post date:** [March 22, 2007, 10:58pm UTC](https://www.ruby-forum.com/t/code-completion-for-ruby-net-beans-rdt-and-more/89816/3 "2007-03-22T22:58:44Z")

</div>

On 3/22/07, S. Robert J. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> to params if and only if all of the keys match the arg names.  
> parse(‘readme.txt’, {:bad\_param =\> ‘b’})  
> and it would be up to the parse method to handle as it normally does.
> 
> This would allow:
> 
> - real named params
> - more explicit method definitions
> - code completion
> - preserve the current style

Named parameters is in the ToDo file on 1.9 distribution:

- named arguments like foo(nation:=“german”) or foo(nation: “german”).

so you may get what you want  
pth
