RE: A question about certain language features

new topic     » goto parent     » topic index » view thread      » older message » newer message

> As near as I can see, Pass By Reference involves a 'deep' change
> to the language. Every modification to every passed variable
> must check if the variable is a reference. This single extra
> check would noticeably slow down all programs, violating a
> prime design goal of Eu.
> I partially implemented PBR and was surprised to find that
> it slowed any program that did not use it extensively by
> 10-15%.

With your implementation, it is nessecary to perform checks everytime a 
PBR variable is expressed.

If the PBR is declared when the paramter is declared, instead of when 
it's accessed, then those checks can be eliminated.

As a solution to the difficulty discerning between PBR and PBV, PBR's 
should be modified through special routines. This would help 
readability, because people would know when they see the assignment, 
that it is PBR, and not a PBV.
Something like:  set_var(arg,get_var(arg)+10)

I think this is the main reason for any confusion between PBV and PBR.

Yeah, it aint pretty, but I don't think it's possible to make PBR 
esthetically pleasing and still keep all the functionality.

Only routines would allow for PBR. Wouldn't the routine be optimised by 
the interpreter during parsing? Each routine is read in before it's 
executed. It's not inline code. I don't see the need to have any checks 
at runtime.

Personally, I am not enthusiastic to see EU with PBR. I suggested PBR 
before as a solution to being able to modify variables in type defines 
ONLY. No PBR for other routines. If you want PBR in a regular routine, 
declare it as a function and pass the modified variables as the result. 
You can't do that with type defines.


Chris

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu