On Thu, Jul 24, 2008 at 8:55 AM, Adelle Hartley <[EMAIL PROTECTED]> wrote:
> Ben Leslie wrote:
>>
>> Unless there was a reason to use the intermediate variable I would always
>> use 'run-on dereferencing'. And would probably get people to change to
>> run-on dereferencing in a code review if I saw it in other people's code.
>
> What's your answer to Steve's question?

Well, I'm used to programming C, and in that case it is impossible for them
to be null. ;)

So maybe the C equiv is using -> instead of . In this case it depends. Ideally
I will be using something like splint, which allows me to make assertions about
fields being notnull. Obviously if it is possible for it to be null
then using intermediate
values is definitely required, but then so is checking them, so you wouldn't see
the original pattern of

var x = a.b
var y = x.c
var z = y.d

You would see the error checking in there.

Of course if you are using a so-called 'modern' language with these
wacky 'exceptions',
then I would just wrap the thing in a try block, or punt it up a
level, and use the
run on dereferencing.

Benno
_______________________________________________
coders mailing list
coders@slug.org.au
http://lists.slug.org.au/listinfo/coders

Reply via email to