Page 2 of 2 <12
Topic Options
#94367 - 2002-11-01 07:44 PM Re: RFC - Hungarian Notation for KiXtart & KiXforms - Discussion
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Speaking of what feels right (not sure if this has already been discussed) did we ever come to a collective decision in terms of what constitutes a boolean TRUE ?

-1 ?
1 ?

For those that like to test absolute values. My suggestion would be that boolean true be whatever the NOT 0 expression resolves to.

[ 01. November 2002, 19:48: Message edited by: Shawn ]

Top
#94368 - 2002-11-01 07:45 PM Re: RFC - Hungarian Notation for KiXtart & KiXforms - Discussion
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I started to think that boolean, and if it does not meet actual boolean definition, there is no actual boolean in kixtart.
meaning that you can't create false and true in "normal" way.

this in mind, as long as you keep the same rule all the way in the script, it will pass.
_________________________
!

download KiXnet

Top
#94369 - 2002-11-01 07:47 PM Re: RFC - Hungarian Notation for KiXtart & KiXforms - Discussion
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hah, the board went down.
_________________________
!

download KiXnet

Top
#94370 - 2002-11-01 08:11 PM Re: RFC - Hungarian Notation for KiXtart & KiXforms - Discussion
kholm Offline
Korg Regular
*****

Registered: 2000-06-19
Posts: 714
Loc: Randers, Denmark
Shawn,

I aggree on this

0 (Zero / Nothing / or empty) is False
Anything else is True

This is already part of the general KiXtart syntax.
An empty string is FALSE
A Not defined variable is FALSE

Return of an object from COM (GetObject/CreateObject) should alse be FALSE
If the operation fails

Top
#94371 - 2002-11-01 08:26 PM Re: RFC - Hungarian Notation for KiXtart & KiXforms - Discussion
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
I agree Erik, anything that is NOT 0 is true.

FYI with COM, its generally recognized that when forced to specify a value for TRUE, everyone uses -1. Its interesting to note however that when Kixtart evaluates NOT 0, it returns a 1 (which to my mind, is intuitively a better TRUE than -1 is) and I think why this situation occured has more to with with the history and legacy of Kixtart more than anything else, even though the NOT operator was added late in the game (not sure really).

I know that we're talking around isoteric issues here, but does it make sense to leave FALSE as an unspecified value that is NOT 0 ? Im cool with it because I tend to pratice poor coding habits anyways. Break more rules than I follow thats to be sure. The question really becomes, is a statement like this best pratice:

code:
if $bFlag
; then do something true
else
; do something else false
endif

because that would be the impact of leaving boolean TRUE as un-specified. From what I've seen around this board, this kind of opened-ended if statement expression is frowned upon, fe: the best pratice version of above ?

code:
if $bFlag = 1
; then do something true
else
; do something else false
endif

[edit]

lol - heres a quasi best practice variant:

code:
if not not $bFlag
?"true"
endif

I need some coffee.

[ 01. November 2002, 20:32: Message edited by: Shawn ]

Top
#94372 - 2002-11-01 08:32 PM Re: RFC - Hungarian Notation for KiXtart & KiXforms - Discussion
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
this goes to the bone of kixtart.
the freenes is to do:

if instr("acb","b")

it's instr and as such true, but kixtart also returns a value for that.
so, it actually checks for true/false and location.
this also raises the issue how well kix can have a hn specification as also:
if "a"

results in true.
but, this is one of the strengths of kixtart and I would not go disturb this with standardation.
_________________________
!

download KiXnet

Top
#94373 - 2002-11-01 09:04 PM Re: RFC - Hungarian Notation for KiXtart & KiXforms - Discussion
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
yap - INSTR() is a perfect example of why NOT 0 is a great definition of TRUE. Maybe great is NOT a good word ... usefull would be a better word. I guess it could also be coded as:

code:
if instr("abc","b") > 0
; ...
endif

all the more reason why I think a 1 is more TRUE than -1 is. And even more reason why Ruud should build TRUE and FALSE into the language (just like almost every other language one can name) ala: @TRUE and @FALSE macros. I mean, when coding a UDF that returns a boolean, wouldn't it be more convenient (and standardized) if we could just say this:

code:
return @TRUE

Then for those that like to code both sides of the expression, they can just say this:

code:
if $rs = @TRUE
; ...
endif



[ 01. November 2002, 21:09: Message edited by: Shawn ]

Top
#94374 - 2002-11-01 09:19 PM Re: RFC - Hungarian Notation for KiXtart & KiXforms - Discussion
kholm Offline
Korg Regular
*****

Registered: 2000-06-19
Posts: 714
Loc: Randers, Denmark
There is 10 kinds of people that understands binary code.

Should that be:
There is -10 kinds of people that understands binary code. ???

I miss that sig. [Smile]

-Erik

No overrun if you convert it, Using CDBL()

Top
#94375 - 2002-11-01 09:56 PM Re: RFC - Hungarian Notation for KiXtart & KiXforms - Discussion
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
Coffee, Shawn? I need one of Don Cherry's wobbly brown pops after this.
So, a simple request evolves into a fascinating logic-fest, from which the consensus seems to be that False is False always, and True is True always, sometimes. [Eek!]
_________________________
We all live in a Yellow Subroutine...

Top
#94376 - 2002-11-01 10:00 PM Re: RFC - Hungarian Notation for KiXtart & KiXforms - Discussion
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
waltz,
there is the best part!
while coding with kixtart 1 can be 0 and vice versa.
but, you should always remember that in the same code range it is what you make it to be.

that is, unless you change it in the...

one can always make code hard as simple old time sample tells:
code:
for $c=1 to 2
$c=0
next

_________________________
!

download KiXnet

Top
#94377 - 2002-11-01 10:43 PM Re: RFC - Hungarian Notation for KiXtart & KiXforms - Discussion
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
Okay, Lonkero...You've finally fried my brain for today with that bit of wisdom...Heading to the beer store and then to the beach for the weekend... [Big Grin]
_________________________
We all live in a Yellow Subroutine...

Top
#94378 - 2002-11-01 10:45 PM Re: RFC - Hungarian Notation for KiXtart & KiXforms - Discussion
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Bring your ice skates...
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#94379 - 2002-11-01 10:46 PM Re: RFC - Hungarian Notation for KiXtart & KiXforms - Discussion
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
oh those canadians, you're starting this late?
my "work" load start at tuesday...

to be serious, viina (similar to russian vodka) which I drink currently is not bad at all...
_________________________
!

download KiXnet

Top
#94380 - 2002-11-01 10:47 PM Re: RFC - Hungarian Notation for KiXtart & KiXforms - Discussion
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
les, have ice there too?
last winter it went to half of december lakes iced up...
_________________________
!

download KiXnet

Top
#94381 - 2002-11-01 10:50 PM Re: RFC - Hungarian Notation for KiXtart & KiXforms - Discussion
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
We like to joke about our short summers...

Sombody asked "What are you doing next summer?" to which was the reply "Well, if it falls on a weekend maybe I'll go to the beach".
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#94382 - 2002-11-01 11:01 PM Re: RFC - Hungarian Notation for KiXtart & KiXforms - Discussion
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
oh boy!
that is short!

we still have 3-4 month summer (meaning over 15 degrees celcius)...

someone thinks that is not much, but live in country where winter is -50 celcius, even 0 seems like +30!
_________________________
!

download KiXnet

Top
#94383 - 2002-11-01 11:18 PM Re: RFC - Hungarian Notation for KiXtart & KiXforms - Discussion
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
rofl - Don Cherry's brown pops - it would be interesting to invite Don Cherry to this forum to give us his own take on the subtle flavours of TRUE ... I can just see it now ...

"Ah jeez them booleans are a joke ... just make 'em zero or dat -1 thingy dare and get on with it eh ! whats da big deal dare eh ? It aint friggin rocket science ya know!"

roflmao

[ 01. November 2002, 23:19: Message edited by: Shawn ]

Top
Page 2 of 2 <12


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1574 anonymous users online.
Newest Members
BeeEm, min_seow, Audio, Hoschi, Comet
17882 Registered Users

Generated in 0.085 seconds in which 0.04 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org