Who's idea was it to make "Main" and "Current"...

BlitzMax Forums/BlitzMax Programming/Who's idea was it to make "Main" and "Current"...

JoshK(Posted 2009) [#1]
Who's idea was it to make "Main" and "Current" keywords? This is awful.


Czar Flavius(Posted 2009) [#2]
I wondered what this is about!


Dreamora(Posted 2009) [#3]
If I wouldn't know it better then I would say those are thread handles, for the process main thread as well as the current thread within you are working.

If thats the case then they potentially would have been better named them "more meaningfull"


Brucey(Posted 2009) [#4]
Truly awful indeed...

I think Mark should ask us first next time...


I wonder why this works:
SuperStrict

Framework brl.standardio

Local Current:Int = 10

Print Current


How... strange...


Czar Flavius(Posted 2009) [#5]
Well I had a "main" variable in my program from the beginning!


beanage(Posted 2009) [#6]
@Brucey: If you refer to the "Current" Identifier.. you are propably overriding it. Imho there also should be a String.FromInt missing. Imho.


Czar Flavius(Posted 2009) [#7]
Imho there also should be a String.FromInt missing. Imho.
Huh?


ImaginaryHuman(Posted 2009) [#8]
Sorry for your loss, man ;-)


JoshK(Posted 2009) [#9]
The reason I bring it up is I have a field of a type called "main" (lower-case) and the editor always converts it to upper case. Then the Lua command set is generated, and it is case-sensitive, so I have accidentally caused errors with that.

I suggest leaving the commands along and just making them not highlighted. Or replace them with highlighted commands MainThread() and CurrentThread(), and leave the old commands in for backwards compatibility.


markcw(Posted 2009) [#10]
Agreed these are too general. Maybe change to GetMain and GetCurrent?


grable(Posted 2009) [#11]
Its more a fault of the documenter/highlighter.

Documented Functions within a type are marked as keywords, but the highlighter doesnt respect type relationships.

In the case of the thread module its actually TThread.Main() and TThread.Current() (

If you dont like this, i bet you must love Create ;) hehehe


Czar Flavius(Posted 2009) [#12]
I thought Create was highlighted as a nice little extra and a small hint as to what I should name my constructor??? You mean it's not???? It's just some other function not highlighting properly??? WOW. My whole world has come crashing down.


beanage(Posted 2009) [#13]
My whole world has come crashing down.

So does mine realising BlitzMax implicitely converts from strings to ints and vice versa, even in SuperStrict mode.


Czar Flavius(Posted 2009) [#14]
Is that a problem? What else do you want Print 5 to do? Make pandas jump across the screen?


beanage(Posted 2009) [#15]
Is that a problem?

I use the SuperStrict mode for being forced to maintain a certain amount of "computational transparency" in my code. Means not leaning into the BASIC syntaxic sugar too far, in favor of "more explicite" code. So this implicite, undocumented conversion is irritating considering what I expect SuperStrict to do.

[Edit:] Of course opinions generally differ on the undocumented meaning of SuperStrict, which sucks bugs me.
[Edit2:]
Make pandas jump across the screen?
Huh?


Czar Flavius(Posted 2009) [#16]
From the docs

Type conversions
The following type conversions are performed automatically by BlitzMax when necessary - for example, when assigning an expression to a variable, or when passing an expression to a function:

Source type		Target type 
Integer			Floating point, String 
Floating point		Integer, String 




markcw(Posted 2009) [#17]
Maybe you could make the bracket determine the difference eg.
main = 1 ' normal var
Main( ' now it's a method



Chroma(Posted 2009) [#18]
I agree. I have a type field called current...


Dreamora(Posted 2010) [#19]
Transparently calling ToString() methods behind the scene is a standard in managed language.
Whenever something is used in a string and no string is provided, its expected that it next tries the ToString () method, which at least in object derivates is present by default and if not overriden will output the pointer.
For numerics its handled "around the corner" but it still does the same.

BM would be an epic fail if it would not behave that way independent of the mode.