Re: Eu's poor design

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

On Sun, Aug 17, 2003 at 08:37:53PM +0000, Andreas Rumpf wrote:
> > In that case, my way is easier!
> > 
> > x = seq[1][2][3]
> > x = some_func(x)
> > x = some_other_func(x)
> > for i = 1 to length(x) do
> > 	x[i] = ....some stuff here....
> > end for
> > seq[1][2][3] = x
> > 
> > jbrown
> 
> Yes, that's the way to go in Euphoria. But I think, the
> seq[1][2][3] = x
> command is often forgotten.

Perhaps. An understandable mistake from a newbie programmer, to be sure.

It would be better to do this:

alias x as seq[1][2][3]
x = some_func(x)
x = some_other_func(x)
for i = 1 to length(x) do
	x[i] = ....some stuff here....
end for
--no need for a 'seq[1][2][3] = x' as the alias automaticly causes the original
--slice to be updated.

This alias technique can be considered close to pbr, tho depending on its
implementation it might be considered closer to that of a "#define" or a macro
(but as I have already shown the 2 arent really that far apart anyways).

> And if you look at Rob's hash.e and 
> translate it to a program that uses pbr (assuming Eu would have it)you 
> will find out that pbr is less error-prone, easier to understand and 
> more efficient.
> 

Concurred. I'm not against PBR in the language. What I am saying is that the
lack of PBR is not a difficult workaround (worst case senario: you have to use
a global sequence and sequence indexes to simulate pbr).

jbrown

-- 
 /"\  ASCII ribbon              | http://www.geocities.com/jbrown1050/
 \ /  campain against           | Linux User:190064
  X   HTML in e-mail and        | Linux Machine:84163
 /*\  news, and unneeded MIME   | http://verify.stanford.edu/evote.html

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

Search



Quick Links

User menu

Not signed in.

Misc Menu