Re: pass by reference

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

On Thu, 21 Feb 2002 02:13:34 +0000, bensler at mail.com wrote:

>
>I think you misunderstood,
>
>  The question was not "Why would I want to use typechecking", but "why
>would I want to use typechecking to make my program crash"

for testing purposes (only)

>Typechecking would make more sense if we could modify the variable in
>question. Alot of the times, you would be able to change the variable
>being typechecked to a default value. This would save your program from
>crashing.
Hmmm............. (lots of hmms)

>
>As a customer who purchases software, I would be appalled to run a
>program that I paid money for, to have it crash with some error message
>that doesn't help me at all. Reminds me of Microsoft :P

Are you happier if a program you purchased crashes and burns, or if it
does not perform as advertised/is not fit for task?

If I spend say 2 hours typing in stuff & the program crashes and
burns, losing all my stuff, then I am NOT HAPPY.

If I spend say 2 hours typing in stuff & the program either pops up
some drivel warning or simply wipes all the stuff I was doing, then I
am not  just "NOT HAPPY", I am seething with rage at the useless c***
who coded this c*** and spotted a few error cases and then did f***
all but s*** about it, the lazy ****ing **** **** ******* piece of
****. I''l show the **** what ****ing ***** his mother and father
***** ***** ***** ** *** ***** usless *** of a **** can do.


If the type check fails so you save loads & loads of stuff for
possible recovery, then good on ya, but if you're gonna write code
that says 'This should never be 9. I don't care how, why or at all, so
I'll just set it back to a nice safe 0", then **** you.

>It makes alot more sense to at least ATTEMPT to rectify the problem
>before resorting to the BLACK screen of death.

As above, I fail to see how hiding the cause of the problem can
possibly help. If you suspect there is going to be a problem modifying
variable x then why not make it a private variable in a new include
file with all the routines, checks etc to modify it?

>Let's face it. EVEN IF you write a program that is 100% error free, it's
>>usually the user who is the cause of the error.

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!.   **** YOU!.

If that is not an open admittance, what the hell is?

> And if I'm distributing
>a program, I want to be sure that I can minimize any program/user
>errors.

Try testing it then

>
>There are lots of other uses for typechecks that can mutate it's
>variable.
>
<snip>
>There are about 50 or more routines in exotica which take a color
>parameter. That's about 50 lines or more of mundane code to type and
>make typing mistakes in.
>
>If I could mutate the variable from a type check, all I would need is
>a type defined like this:
>
>type color(object c)
>   if sequence(c) then c = make_rgb(c) end if
>   return 1
>end type

That's reasonable, however if you wrap your routines:

procedure setColour(object c)
xsetColour(mapcolour(c))
end procedure

then all is well.

>> With type checking your code fails sooner (when it would fail any way
>> only
>> at some other place) and you are closer to the source
>> of your problem. You find out what's wrong in less time. Faster
>> debugging.

Correct.

Pete

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

Search



Quick Links

User menu

Not signed in.

Misc Menu