Handles and IDs

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Handles and IDs

Post by Dare2 »

This is a request for a standardisation of terminology, both in the language and the docs.

Currently we use the term "ID" a lot, with a lot of different contexts, probably a legacy thing as PureBasic evolved.

Would it be possible to have some new PureBasic keywords that help to differentiate between things? (Note: The parser/tokeniser could remap to existing commands, which remain - this means no change to final exe size, the preprocessing does the work). So, for eg:

Code: Select all

result = getOsHandle(#number)
result = getPBNumber(#number)
And in docs, etc, could we start to use different terminology to refer to different things, using:
  • Handle = OS Handle.
    #Number = Gadget,File,etc, IDs
    PBnumber = internal value
    ID = nonspecific, as it now is, and deprecated.
If the docs used stronger "typecasting" :) in terminology, then we would as well, and communications programmer-program and person-person would become clearer.

BTW, I am not suggesting those actual keywords or terms, just using them as examples. Cleverer minds than mine can come up with some good terms.

Thanks.

PS:

Extended, via remapping, we could even do things like:

WriteString([#number,]text$)
which would remap to:
UseFile(#number)
WriteString(text$)


Purebasic being smart enough to recognise the extra parameter as a #number. ( Which Fred could implement in a spare few hours. lol :D )
@}--`--,-- A rose by any other name ..
Intrigued
Enthusiast
Enthusiast
Posts: 501
Joined: Thu Jun 02, 2005 3:55 am
Location: U.S.A.

Re: Handles and IDs

Post by Intrigued »

Dare2 wrote:This is a request for a standardisation of terminology, both in the language and the docs.

Currently we use the term "ID" a lot, with a lot of different contexts, probably a legacy thing as PureBasic evolved.

Would it be possible to have some new PureBasic keywords that help to differentiate between things? (Note: The parser/tokeniser could remap to existing commands, which remain - this means no change to final exe size, the preprocessing does the work). So, for eg:

Code: Select all

result = getOsHandle(#number)
result = getPBNumber(#number)
And in docs, etc, could we start to use different terminology to refer to different things, using:
  • Handle = OS Handle.
    #Number = Gadget,File,etc, IDs
    PBnumber = internal value
    ID = nonspecific, as it now is, and deprecated.
If the docs used stronger "typecasting" :) in terminology, then we would as well, and communications programmer-program and person-person would become clearer.

BTW, I am not suggesting those actual keywords or terms, just using them as examples. Cleverer minds than mine can come up with some good terms.

Thanks.

PS:

Extended, via remapping, we could even do things like:

WriteString([#number,]text$)
which would remap to:
UseFile(#number)
WriteString(text$)


Purebasic being smart enough to recognise the extra parameter as a #number. ( Which Fred could implement in a spare few hours. lol :D )
If anything your post helped me to clearly see what means what. :-) Thanks.
Intrigued - Registered PureBasic, lifetime updates user
GreenGiant
Enthusiast
Enthusiast
Posts: 252
Joined: Fri Feb 20, 2004 5:43 pm

Post by GreenGiant »

Here's a nice tip I picked up from Sparkie.

Gadget_Constant = GetDlgCtrlID_(Gadget_hWnd) is an api command that inputs the api handle to a gadget and then outputs the PB corresponding constant.

Doesn't really solve your problem but is basically the getPBNumber(#number) command.
Post Reply