Page 2 of 2

Re: any kind of alfanumeric variables

Posted: Thu Feb 23, 2012 2:25 am
by STARGÅTE
File -> File-format -> UFT8
compiler -> enable unicode
Debug -> MessageRequester

and i get:

Code: Select all

Define String.s = "ŠTĚPÁNEK ŻEWŁAKOW"

MessageRequester("", String)
---------------------------

---------------------------
ŠTĚPÁNEK ŻEWŁAKOW
---------------------------
OK
---------------------------

Re: any kind of alfanumeric variables

Posted: Thu Feb 23, 2012 2:35 am
by skywalk
umm, debug output?

Re: any kind of alfanumeric variables

Posted: Thu Feb 23, 2012 9:51 am
by Psychophanta
I get
ŠTĚPÁNEK ŻEWŁAKOW

with:
File -> File-format -> plain text
compiler -> DIsable unicode

with debug output and also with MessageRequester

Re: any kind of alfanumeric variables

Posted: Thu Feb 23, 2012 8:48 pm
by Tenaja
Psychophanta wrote:and now...
the question is:
why not?
(NOTICE: answers like "because every language is not like that" or "because everytime has been like that", etc, are not considered valid, because it is not a valid argue)
The biggest reason "nobody does it that way" is because when we are about 12 years old, we learn that y=4x means y=4*x. To permit a number in the first position of a variable will confuse 100% of the new users. It is not merely a "different way to do things," but it contradicts everything taught about variables and numbers outside of programming--and these practices are centuries old. That's why nobody does it that way; to avoid confusion.

As far as parsing goes, it is trivial to implement it, and has nothing to do with the decision. PB has a super simple parser, so perhaps it only looks at the first character to determine the next token for all numbers (123, $123, #abc, etc.), but many languages allow mixing of numbers and characters (0x123, 0b1001, for instance), and allowing this would be far from complex. The syntax is simple, very easy to implement, and would not require "42" to be a variable if you require that all variable-names contain at least one non-number character. In fact, it would be no more difficult than allowing the underscore in a name.

So, why not? Mostly, to avoid confusion.

Re: any kind of alfanumeric variables

Posted: Mon Mar 12, 2012 9:16 pm
by charvista
Clarity would be lost and confusion would be huge, but you can use the underscore symbol :mrgreen:

Code: Select all

_12e4=4
_4t=-7
_42=-2
Debug _12e4*(_4t-_42)+(_12e4+_42)*_4t

Re: any kind of alfanumeric variables

Posted: Tue Mar 13, 2012 11:27 am
by Psychophanta
charvista wrote:Clarity would be lost and confusion would be huge, but you can use the underscore symbol :mrgreen:

Code: Select all

_12e4=4
_4t=-7
_42=-2
Debug _12e4*(_4t-_42)+(_12e4+_42)*_4t
Good and simple idea, just useful for me. Thanks!