2008/7/24 Adelle Hartley <[EMAIL PROTECTED]>: > Hi all, > > I've a question that I'm too lazy to google (and besides, the answers from > people on this list might be more interesting) - > > From the short list of programming languages that I'm familiar with, all of > them that I can think of, use parentheses to mark the beginning and end of a > list of parameters to a function, > eg. > DoSomething(param1, param2); > > Are there many programming languages in which the parentheses may be omitted > when calling a function under certain circumstances, such as the parameter > list having zero parameters, or the function has a specific semantic > property (such as being a property accessor)?
Perl I think lets you omit parens depending, but I don't remember enough about perl (thankfully) to recall the specifics. Lisp doesn't use parens to specify function arguments, they're used *outside* of the function expression, which is similar to how Haskell does it, though in Haskell you can omit the parens as long as the paren-free expression isn't ambiguous (ie. you're not trying to create a curried function in a parameter list -- then you need to quote it with parens). I'm scaring myself by remembering that... > A related question: which programming languages allow me to replace the > declaration of a variable with a parameterless function, without also doing > a search & replace for each instance where the variable is used? In python you can mark an attribute as a property, and then you specify a "getter" and "setter" method that get implicitly called when that attribute is accessed. Further, the __getattr__ and __setattr__ methods can be overwritten to give you crazy control over what the class does. That's all I've got so far. _______________________________________________ coders mailing list coders@slug.org.au http://lists.slug.org.au/listinfo/coders