What is your favorite identifier reference char?

BlitzMax Forums/BlitzMax Programming/What is your favorite identifier reference char?

beanage(Posted 2009) [#1]
I see XML using '#'
I see PHP using '$'
I see myself using '%' or '!' or '?' or Chr( $XX ) for my next scripting language depending on my mood.
I see confusion.

What do you see?


markcw(Posted 2009) [#2]
I see a little grey rabbit if you must know. What do you mean by 'identifier reference char'?


Czar Flavius(Posted 2009) [#3]
I think he means symbols you put in front or on the end of variable names, to signify they are variables? But I don't know. In any case, I prefer "".


beanage(Posted 2009) [#4]
Czar you are right. Of course "" is the best, but sometimes some systems require an extra character.. my scripting language is supposed to be OOOP, and there's no plain values, just objects.

So..
MyVar:= myVar2 'can mean value assignment..
MyVar:= myVar2 'can mean object assignment..
..is obviously not clear.

And..
myVar:= myVar2 'means value assignment..
myVar:= @MyVar2 'means object assignment..
..is clear.

Gettin' my point?


taxlerendiosk(Posted 2009) [#5]
So don't call your variables things like MyVar and MyVar2 :)


Czar Flavius(Posted 2009) [#6]
I don't know much about OOOP so perhaps this is a stupid question, but if there are no plain values, only objects, then how does the ambiguity between value and object assignment result?


ziggy(Posted 2009) [#7]
My favourite is none :D

If that's the situation where confusion can appear, wouldn't it be easier to

1.- Go the BASIC way, it is, it's always an object assigment, it's up to any object to provide a 'clone' method.

.. or ..

2.- Go the ancient VB way, it is always a value assignment, except when using a SET operator
SET MyInstance = ThisOtherInstance


markcw(Posted 2009) [#8]
I see thanks Czar.

Why would you want to use '%' or '!' or '?' or Chr( $XX )? Why not use what is most common in other languages? In this case '$', lots of languages use that.


N(Posted 2009) [#9]
Gettin' my point?
The solution to this is to remove 'values.'


beanage(Posted 2009) [#10]
In this case '$', lots of languages use that.

Ah, finally; 1:0 for "$" ;)

Of course you are all right.. i heard of people saying radically each keyword a language allocates is a weak design point.. lol, thats the LISP programmers..

I will think about that all again. "$" .. this looks like a value indicator to me. "@" looks like an object indicator. A t m .

Alright, shaping opinion: Object assignment is without any prefix, value assigment/ request goes with '$'.

@Czar: [<---see the @ I use to adress you?] I thought of an object having basically an *information*, a *type*, *subobjects*, and in cases of classes, functions, variables and other identifiable objects, a *name*.

So assignment can go in two ways, either fetching the value or fetching the whole object, so the target in fact 'is' the assigned obejct.


Perturbatio(Posted 2009) [#11]
Personally I see the @ as a reference (i.e. assign a pointer to the thing I'm prefixing to the variable on the left).

so:
myVar2 = new ObjectOfSomeSort()
myVar2.name = 'test'
myVar:= @myVar2
print myVar.name //prints 'test'



beanage(Posted 2009) [#12]
@Perturbatio:

Yes, thats what i thought too..
In addition, your example brings in another point, namely different operators:

MyVar = 'value' //value assignment
MyVar := 'value' //value assignment too, system wont make a difference there
MyVar = MyVar2 //value assigment
MyVar := MyVar2 //object assigment


Wouldnt that even be mathematical correct definition assignment syntax?.. that might make sense.. Actually the only thing I want is avoiding axiomatic syntax.