The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Named Parameters? Aren't They All Named?

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Red Handed

Posts: 1158
Nickname: redhanded
Registered: Dec, 2004

Red Handed is a Ruby-focused group blog.
Named Parameters? Aren't They All Named? Posted: Oct 18, 2005 3:39 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Red Handed.
Original Post: Named Parameters? Aren't They All Named?
Feed Title: RedHanded
Feed URL: http://redhanded.hobix.com/index.xml
Feed Description: sneaking Ruby through the system
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Red Handed
Latest Posts From RedHanded

Advertisement

None of us wants to delve back into the block/method/param argument again, right? But we could still use a good answer. Dan Berger has an explanation of how Sydney got named parameters without need to plunder Ruby’s current method definitions.

 # A standard Ruby method declaration
 def foo(a, b, c=4)
   ...
 end

 # Ideal syntax
 foo(a:1, b:2, c:3) # a=1, b=2, c=3
 foo(a:1, b:2)      # a=1, b=2, c=4
 foo(1, 2, c:3)     # a=1, b=2, c=3
 foo(1, 2, 3)       # a=1, b=2, c=3

If you’d like to give Sydney a try, scan for tarballs on Evan’s blog. (Spotted on Late to the Party.)

Read: Named Parameters? Aren't They All Named?

Topic: A little bling-bling in your browser Previous Topic   Next Topic Topic: Trails v .5 released

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use