Thread overview
[Language design] trapped into an error due to opCall
Feb 24, 2004
Manfred Nowak
Feb 24, 2004
Juan C
Feb 24, 2004
Manfred Nowak
February 24, 2004
I am playing with the implementation of a hashing function `f'.

The hashing function is implemented in a class using `opCall'. One definition looks like `void opCall( void* ptr)'. This definition was tested and worked.

Further testing and extending the class showed, that I had to use a
function `foo' that was used like
`someVariable= foo(someVariable);'.

Instead of making `someVariable' public, I decided to include one further
definition of `opCall':
  void opCall( int delegate(int) bar){
    someVariable= bar(someVariable);
  }
and used it like `f(&foo)'.

I got wrong results. Reactivating the printouts of the `opCall' first mentioned showed that it got wrong data: `224 0 0 0' instead of `0 0 0 0'.

If you already see, what error I made, then you need not unrot13 the following nor even look at it:

`sbb' jnf abg n shapgvba, nyfb vg ybbxrq nyvxr. Vg jnf n pynff gung hfrq
`bcPnyy' vgfrys. Fb gur pbeerpg pnyy unq gb or `s(&sbb.bcPnyy)' vafgrnq bs
`s(&sbb)'.

Should the language take precautions to prevent such errors?

So long.






February 24, 2004
<snip>
In article <c1e4fq$hn4$1@digitaldaemon.com>, Manfred Nowak says...
>Should the language take precautions to prevent such errors?
</snip>

As long as what's written is valid the language shouldn't prevent the user (or is that misuser?) from making errors. We're all free to make whatever errors we like.


February 24, 2004
Juan C wrote:

> As long as what's written is valid
[...]

Did you change your mind since <br5a3o$jea$1@digitaldaemon.com>?

So long.