[Implemented] Command system getting 'messy'?
Posted: Fri Apr 16, 2004 1:05 pm
Hi,
Before you go mad at me, please hear me out
Since #PB_ANY came out, I think that a lot of commands have become obselete, yet they get used anyway. In particular, Use<something>().
For example:
In this code it's obvious to see that readstring() will read from stream Y, but how on Earth do I get it to read data from Stream X without opening it again?
Usefile(x) and UseFile(y) don't work for this, and they sound like the only way to do it.
I think it would be a lot easier and logical to refer to everything by a returned handle, possibly removing the whole 'ID table' system:
I know this brings backward-compatibility issues, but it wouldn't exactly be hard to sift through an old program and convert it to this sort of system. Backward-compatibility seems to be what makes Microsoft's programs so big, bloated and buggy.
The same general rule applies to things like directories. The other day I tried to make a recursive directory browser in PB. I ended up with a bunch of "UseDirectory()" calls in completely illogical (at first glance) places, just to get it to work, whereas in Blitz (sorry to bring this up, but it's true) I could just refer to each directory with a handle that expired once it dropped out of scope, so I didn't have to worry about it again.
Don't get me wrong, I love the PB language, it just seems that there's a lot of power being left out because of this system, and although the system has changed, the artifacts of the old one are still there.
-Kris
Before you go mad at me, please hear me out

Since #PB_ANY came out, I think that a lot of commands have become obselete, yet they get used anyway. In particular, Use<something>().
For example:
Code: Select all
x = OpenFile(#PB_ANY,"c:\boot.ini")
y = OpenFile(#PB_ANY,"c:\pbidetest2.rtf")
While Eof(x) = 0 And Eof(y) = 0
Debug ReadString()
Wend
Usefile(x) and UseFile(y) don't work for this, and they sound like the only way to do it.
I think it would be a lot easier and logical to refer to everything by a returned handle, possibly removing the whole 'ID table' system:
Code: Select all
x = OpenFile("c:\boot.ini")
y = OpenFile("c:\pbidetest2.rtf")
While Eof(x) = 0 And Eof(y) = 0
Debug ReadString(x)
Debug ReadString(y)
Wend
The same general rule applies to things like directories. The other day I tried to make a recursive directory browser in PB. I ended up with a bunch of "UseDirectory()" calls in completely illogical (at first glance) places, just to get it to work, whereas in Blitz (sorry to bring this up, but it's true) I could just refer to each directory with a handle that expired once it dropped out of scope, so I didn't have to worry about it again.
Don't get me wrong, I love the PB language, it just seems that there's a lot of power being left out because of this system, and although the system has changed, the artifacts of the old one are still there.
-Kris