Bug or feature?

Previous topic - Next topic

bigsofty

Functions that are used like this, work...

Code (glbasic) Select
LOCAL myb%= init_myb(100)

but...

Code (glbasic) Select
GLOBAL myb%= init_myb(100)

... are never called, no error either?
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

Moru

Whatever Gernot says I never initiate a variable with a function, no matter what :-)

Kitty Hello

They should be called. But! Before the main starts. They might not STDOUT or DEBUG messages.

I tested and the correct value was assigned.

bigsofty

Hmm, its definitely not working with one of my functions... I'll try to create a better reproducible error listing.
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

bigsofty

OK, 2 files "test2.gbas" and "testlib.gbas"...

Code (glbasic) Select

LOCAL a% = test()
GLOBAL b% = test()
//b% = test() // Unremark me to see it working

DEBUG "a%="+a%+" b%="+b%+"\n"


and...

Code (glbasic) Select
TYPE myType
a#[]
ENDTYPE

GLOBAL myArr[] AS myType

FUNCTION test%:
LOCAL b AS myType
DIMPUSH myArr[], b
l% = LEN(myArr)-1
RETURN l%
ENDFUNCTION


Run to see error.

This is basically an abstraction of my code, I think it could be narrowed down a little further though.

Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

Kitty Hello

a=1, b=2 - fine?

bigsofty

#6
With remark in place, "a%=1 b%=0" for me?

BTW I'm using version 9.040
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

MrTAToad

Ahhh - Try V10 :)

bigsofty

Ooh ran out of time today, I'll give a wee go 1st thing tomorrow.  ;)
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

MrTAToad

It works in V10 - whether in 1 file or multiple ones :)

bigsofty

OK, confirmed, this has been fixed in the current V10 beta!  =D
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)