[futurebasic] Re: [FB] String <=> Handle

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : September 1999 : Group Archive : Group : All Groups

From: tedd <tedd@...>
Date: Sun, 12 Sep 1999 10:19:55 -0400
Jay:

>Looks good to me. There are a couple of insignificant changes I would
>probably make, just because I'm passionate about tight code. (If you
>don't make the changes, I guarantee you'll never know the difference.)
>
>1. If FN NEWHANDLE(0) fails (hard to imagine), theHndl& will already be
>_nil, so you don't really need
>  XELSE
>    theHndl& = _nil

I did that not because it really did anything, but because it read well
(for me) and provided a degree of documentation that I'm passionate about.
When I talk about symmetry in code, I mean that similar functions do
similar things in similar ways. As such, it is my opinion that the basic
constructs and appearance of similar functions should be similar.

---
>2. As a matter of course I prefer to use
>       POKE @theStr$,0
>instead of
>      theStr$ = ""
>because it is faster, even though that often doesn't matter.

I like your preference because it demonstrates what a string is -- namely a
segment of memory that starts with the length of the following string in
memory. What I don't like about it is that it doesn't read quickly (for
me). I think that setting theStr$ = "" is more easily understood in a quick
scan of the code than POKE @theStr&,0.

---
>3. I would avoid a couple of lines and duplicate variable names by
>eliminating
>    theStr& = @theStr$
>Just use @theStr$ where you have theStr&.

Again, this is a matter of personal practice/choice. You are obviously more
skilled than I in writing code -- I can tell by your diction. You are more
comfortable writing lines of code that would normally "slow-down" lessor
programmers. I, on the other hand, prefer making code as simple as possible
in form, style and read-ability. As I am sure that you are aware, both
perspectives, like technical journals and children's book, have their
place.

But, in any event, thanks very much for your input and code. It did help me.

tedd

___________________________________________________________________
<mailto:tedd@...>	               http://sperling.com/