Outsourcing software development to Russia
1-800-521-4091
  • Home
  • I need developed
    • Web Applications
      • Social Networking
      • Online eCommerce Systems
      • Rich Internet Applications
      • Client-Server Applications
      • Open Source Integration (CMS/CRM)
      • Web Design
    • Software Applications
      • Business Automation (CRM/ERP)
      • Windows Application Development
      • Unix/Linux Consulting and Development
      • macOS Development
      • POS System Development
      • Asterisk/VoIP Phone System Development
      • Graphical User Interface (GUI) Design
      • Software Research and Development
      • Software Reengineering
    • Mobile Applications
      • iPhone and iPad Development
      • Google Android OS Developers
  • I want to hire
    • Hire Russian Developer
    • Hire Certified ASP.NET/C# Developer
    • Hire iPhone/iPad Developer
    • Hire Android Developer
    • Hire Certified PHP Programmers
    • Hire Front-end Expert
    • Hire Certified Java Developers
    • Hire Russian C++ Programmers
  • HireRussians
    • What is HireRussians?
    • Why HireRussians: FAQ
    • Russia IT Outsourcing Advantages
    • Certifications and Industry Recognitions
    • Testimonials
    • Referral Program
  • Blog
  • Contact Us
GET A FREE QUOTE
Outsourcing software development to Russia
  • Home
  • I need developed
    • Web Applications
      • Social Networking
      • Online eCommerce Systems
      • Rich Internet Applications
      • Client-Server Applications
      • Open Source Integration (CMS/CRM)
      • Web Design
    • Software Applications
      • Business Automation (CRM/ERP)
      • Windows Application Development
      • Unix/Linux Consulting and Development
      • macOS Development
      • POS System Development
      • Asterisk/VoIP Phone System Development
      • Graphical User Interface (GUI) Design
      • Software Research and Development
      • Software Reengineering
    • Mobile Applications
      • iPhone and iPad Development
      • Google Android OS Developers
  • I want to hire
    • Hire Russian Developer
    • Hire Certified ASP.NET/C# Developer
    • Hire iPhone/iPad Developer
    • Hire Android Developer
    • Hire Certified PHP Programmers
    • Hire Front-end Expert
    • Hire Certified Java Developers
    • Hire Russian C++ Programmers
  • HireRussians
    • What is HireRussians?
    • Why HireRussians: FAQ
    • Russia IT Outsourcing Advantages
    • Certifications and Industry Recognitions
    • Testimonials
    • Referral Program
  • Blog
  • Contact Us
Nov 24

To Writing Functions in Ruby w/o Parentheses

  • November 24, 2006
  • 2 Comments
  • PHP Talk, Technologies

by Sibers CTO Andrey Gavrilov

One of the requirements to scripting languages is an opportunity to call a function without using parentheses (e.g., print “test” instead of print (“test”)). The problems arising out of this are obvious as construction func1 func2 “test” with variable parameters can be treated either as

func1(func2("test")) or as func1(func2(),"test") .

Ruby solves the problem by informing about errors just noticing a slightest ambiguity:

def func1(name)
puts name
end

def func2(name)
return name
end


func1 func2 "test"
-:9: warning: parenthesize argument(s) for future version

def func1(name1, name2)
puts name1 + name2
end

def func2()
return "test1"
end

func1 func2 "test2"
-:19: warning: parenthesize argument(s) for future version

It is absolutely right of Ruby to do so as otherwise adding an optional parameter to the function could cause errors in its calling. It looks, though, as a patch to potentially holed syntax.
The most logical solution seems to use only one argument in the form without parentheses. Anyway, using such a form for a few arguments doesn’t improve readability. In such a case form func1 func2 "test" is interpreted only as func1(func2("test")) . The solution is strict but lacks logic as well.
If I wrote a scripting language:
•Form func arg with "arg" being one argument would be the only form to call the function.
•Form ("a", "b", name:"c", "d") would be vocabulary builder

[0] => "a",
[1] => "b",
["name"] => "c",
[4] => "d",

•So when calling a function, it uses its argument as vocabulary, i.e. it tries to fill its arguments from the vocabulary first by name, then by the serial number and finally by the default value. If some of the arguments are left empty, an error is reported.
•To make constructions of the form print "test" work, I’d define property [0] in the class Object, which would point the object itself by default. Thus, when calling a function with one argument without parentheses, it would refer to the object as vocabulary and get it as the first argument (provided [0] is not redefined as in the case with list types). If a function has two arguments and [1] or a property with the name of the argument is not additionally defined, an error is reported.

2 Comments

  1. Idetrorce
    December 15, 2007 at 6:45 PM · Reply

    very interesting, but I don’t agree with you
    Idetrorce

  2. Portland Oregon seo
    January 31, 2011 at 5:15 AM · Reply

    Spot on with this write-up, I definitely think this website needs very much far more consideration. I’ll most likely be again to read significantly more, thanks for that information.

Leave a reply Cancel reply

Your email address will not be published. Required fields are marked *

About

Russia Software Development as seen and done by HireRussians.

Archives

Browse by tags

  • CEO Blog
  • Clients Say
  • Corporate Events
  • green it
  • HOT! Learn Russian
  • Life
  • Links
  • Official Talk
  • Our People
  • Outsourcing
  • QA Talk
  • Russian programmers
  • Silicon Taiga
  • Technologies
    • .Net Talk
    • C# Talk
    • Flash Talk
    • Java Talk
    • Mobile
    • PHP Talk
  • UI&GUI
  • Uncategorized
  • Web 2.0

Recent Posts

  • E-Learning Evolution: Custom E-Learning Development Trends
  • How Custom Development Can Boost Your Printing Business
  • Based on a True Story: Life-Saving Programming Experience
  • Architecture: Why Does it Matter?
  • You Asked, We Answered: Testing, Debugging, and What on Earth Does “Best Practices” Really Mean?

I NEED DEVELOPED

  • Web Applications
  • Web Design
  • Open Source Integration (CMS/CRM)
  • Client-Server Applications
  • Online eCommerce Systems
  • Social Networking
  • Rich Internet Applications
  • Software Applications
  • Windows Application Development
  • Business Automation (CRM/ERP)
  • Unix/Linux Consulting and Development
  • macOS Development
  • POS System Development
  • Asterisk/VoIP Phone System Development
  • Graphical User Interface (GUI) Design
  • Software Research and Development
  • Software Reengineering
  • Mobile Applications
  • iPhone and iPad Development
  • Google Android OS Developers

I WANT TO HIRE

  • Hire Russian Developer
  • Hire Certified ASP.NET/C# Developer
  • Hire iPhone/iPad Developer
  • Hire Android Developer
  • Hire Certified PHP Programmers
  • Hire Front-end Expert
  • Hire Certified Java Developers
  • Hire Russian C++ Programmers

HIRERUSSIANS

  • Contact Us
  • What is HireRussians
  • Why HireRussians: FAQ
  • Certifications and Professional Recognitions
  • Russia IT Outsourcing Advantages
  • Testimonials
  • Referral Program
  • Blog

CONTACTS

Bishkek, Kyrgyzstan Phone: 1-800-521-4091 (USA toll free) E-Mail: sales@hirerussians.com Web: hirerussians.com
Privacy Policy - Refund Policy - © 2005-2025 HireRussians®. All Right Reserved. Sibers®, HireRussians®, Ixobit® are the registered trademarks of Ixobit LLC.
Powered by Olark