Calling Conventions and Pass By Reference

Simon Wistow simon at thegestalt.org
Tue Sep 2 19:18:38 BST 2008


A thought - what would the advantages and disadvantages of having only 
references in a language.

Let's take Perl for example. By only having references we'd clean up a 
lot of syntax confusion - no more $foo{bar} and $foo->{bar}, there is 
only one way to do it.

Related it's much easier to explain to programmers - if you change stuff 
in a method you call it remains changed. 

The downside is that, of course, you can spooky actions at a distance - 
"I passed in this url to this library and it came back relative rather 
than absolute, wtf?".

I suppose then you'd have to have really good, COWed deep cloning 
available which is not a hugely difficult goal (In general, I'm not 
talking about whether or not it's hard to retrofit into an existing 
language).

What other subtleties am I missing? What are the pros and cons from a 
language and culture perspective? From an underlying implementation and 
internals perspective?

S




More information about the london.pm mailing list