Adelle Hartley wrote:

>  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)?

Ocaml has a syntax which is completely different to all of the
languages descended from Algol (Pascal, C, C++, Perl, Python,
Ada and so on) and calling a function called DoSomething with
two parameters is written as:

    DoSomething param1 param2 ;

Haskell has similar syntax in this regard.

> 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?

I don't think there is one. The problem is, how would you specify the
difference between a constant and a function with no parameters?

In Ocaml you would have:

   let pi = 4.0 *. atan 1.0  (* This is a constant. *)

   let func () =
       print_endline "Hello"

To call the function with no parameters you would do:

    func () ;

I hope this helps and I'm really curious about these rather odd
questions :-).

Cheers,
Erik
-- 
-----------------------------------------------------------------
Erik de Castro Lopo
-----------------------------------------------------------------
"Copyrighting allows people to benefit from their labours,
but software patents allow the companies with the largest
legal departments to benefit from everyone else's work."
-- Andrew Brown
(http://www.guardian.co.uk/online/comment/story/0,12449,1387575,00.html)
_______________________________________________
coders mailing list
coders@slug.org.au
http://lists.slug.org.au/listinfo/coders

Reply via email to