Page 1 of 2

another wish for escape character "\"

Posted: Mon Sep 01, 2008 11:45 am
by Tomio
Hello,

This character is of general use in many languages for the special meaning you all know. It has become an unsaid standard since long.

Yes, it would be late to modify PB in this point and surely hurt some apps already in use. But better now then never.

I write this message because I'm about to translate some PB code to javascript and it took me some time to find the reason for a problem: the many '\' must be replaced.

../tomio

Posted: Mon Sep 01, 2008 12:18 pm
by gnozal
You could also use custom escape string functions : http://www.purebasic.fr/german/viewtopic.php?t=11858

Posted: Mon Sep 01, 2008 12:41 pm
by Tomio
gnozal wrote:You could also use custom escape string functions : http://www.purebasic.fr/german/viewtopic.php?t=11858
That's not what I mean.
I mean it would be better for PB (and it's users) in the long run to be in accordance with what is kind of standard.

Notice the name: "escape".

../tomio

Posted: Mon Sep 01, 2008 5:03 pm
by blueznl
Hate it. Hate it. Hate it.

Next thing we'll have to drop our lovely $FF and replace it with 0xFF or similar indecency :-)

Posted: Mon Sep 01, 2008 6:33 pm
by Kaeru Gaman
Tomio wrote:... in many languages ... It has become an unsaid standard since long.

... But better now then never..
Tomio wrote:I mean it would be better for PB (and it's users) in the long run to be in accordance with what is kind of standard.

Notice the name: "escape".
a "standard" this is in languages coming from C.

PureBASIC is no C, and the escaping of strings via chars like backslash has never been and will never be a standard in any BASIC language.

if you need something like this, just start using some language of the C family for your code from the scratch, like JavaScript or whatever.

but don't ask to add any C-specific convention to a BASIC language.


btw:
when creating the ASCII standard, the char Chr(27), Chr($1B) was designed the ESCAPE charakter.
it is used by Priter protocols and such.
so, if you want an escaping char, use Chr(27).
... just kidding, I know it's impossible because it's imprintable...

Posted: Mon Sep 01, 2008 6:51 pm
by Tomio
blueznl wrote:Hate it. Hate it. Hate it.

Next thing we'll have to drop our lovely $FF and replace it with 0xFF or similar indecency :-)
completely different thing.

It's true: '\' as the "true" escape character introduced would suggest to allow '\n' ,... also (in accordance with what is common). But why should this strike your beloved $FF ? Variablenames starting with a '$' do surely not stand in the way of anything out of PB.

As far as I understand, PB is not up to be a game developing tool only.

../tomio

Posted: Mon Sep 01, 2008 6:56 pm
by ts-soft
Kaeru Gaman wrote:
a "standard" this is in languages coming from C.

PureBASIC is no C, and the escaping of strings via chars like backslash has never been and will never be a standard in any BASIC language.
Oh, all other Basic, that i use, supports escaping:
XProfan, EBasic and so on :wink:

Posted: Mon Sep 01, 2008 6:58 pm
by Tomio
but don't ask to add any C-specific convention to a BASIC language.
So you state that PB is pure Basic ??

../tomio[/quote]

Posted: Mon Sep 01, 2008 7:03 pm
by Mistrel
If you really want something like this then you can easily write your own one-pass parser to replace instances of an escape character.

There's no reason you can't make your own escape characters. It just isn't a native language feature.

Posted: Mon Sep 01, 2008 7:06 pm
by blueznl
No, but we all agree it's supposed to be PureFUN :D

Escape chars are one of the WORST inventions ever. The way C(++) uses them is horrible (IMHO appropriate disclaimers etc.).

Either that, or I simply don't like them :wink:

Seriously, it's a matter of taste. I think they make it harder to read code, but it's all personal.

And yes, point taken. PureBasic is not exactly your average basic. Then again, there's little reason to make it any more C(++) like either. So I can understand the argument you'd like to have escape chars even though I don't support them. I just cannot figure out how that escape key has become a 'standard'. Sort of. And frankly, adding escape characters just doesn't feel right for a 'Basic', even if there isn't an official standard...

(Hell, to me SUB feels totally wrong, as opposed to PROCEDURE, it's what you grew up with, I guess :-))

Posted: Mon Sep 01, 2008 7:10 pm
by Kaeru Gaman
Tomio wrote:So you state that PB is pure Basic ??
well, on the top of the page it sais
Image

so what?


anyhow, I don't really care that much if escaping via backslash would be implemented in PB or not....

I just thought it would've been adequate to say
"I really find escaping via \ useful, could you please consider adding it"
instead of
"hay there, escaping via \ is an international standard, so PB should also have it or will be wornout soon"

and something like
it took me some time to find the reason for a problem: the many '\' must be replaced.
sorry, if one started translating some code, checking the way of excaping characters is one of the first things to do, replacing them within the editor is one or two runs with Find/Replace and the egg is baken, so again: so what?


and this:
Mistrel wrote:If you really want something like this then you can easily write your own one-pass parser to replace instances of an escape character.

There's no reason you can't make your own escape characters. It just isn't a native language feature.
simply is true, so ....?

Posted: Mon Sep 01, 2008 7:11 pm
by Demivec
Tomio wrote:
blueznl wrote:Hate it. Hate it. Hate it.

Next thing we'll have to drop our lovely $FF and replace it with 0xFF or similar indecency :-)
completely different thing.

It's true: '\' as the "true" escape character introduced would suggest to allow '\n' ,... also (in accordance with what is common). But why should this strike your beloved $FF ? Variablenames starting with a '$' do surely not stand in the way of anything out of PB.

As far as I understand, PB is not up to be a game developing tool only.

../tomio
Do you use PB much? You seem a little out of touch. blueznl was referring to ways of entering hex values.

I agree with Kaeru though, the choice of character to use for control-actions is dependant on the task. There are various choices depending on the purpose. If it's made possible to use "" for strings, or anything else, that would be fine. If it's not made possible, that would also be fine. That's why these are only requests...we'll wait and see.

gnozal did present a tried and true PureBasic method though, "do it the way you want it" with a little help from others.

Even though you view the "" as a common character for control-actions in a string you may find disagreement as to what should follow it. It's not such a good choice for strings that involve path names or web addresses.

@Edit: I took to long to type this, 5 other people posted in the meantime. :wink:

Posted: Mon Sep 01, 2008 10:52 pm
by Fred
Please calm down, it's just a feature request.

Posted: Mon Sep 01, 2008 10:57 pm
by Tomio
Did you also notice?
Did you also notice that in every forum, be a travel, a cook or a computer forum, just in every!, there seem to be people who have nothing to do all the day long than to gaze at the monitor and wait for a new topic to send replies no matter they know an objectiv answer or not. They just have the urgent need to get off their words.

Well, this is the "Feature Requests and Wishlists" and I wrote why I (personally!) think that it would be convenient to have the Escape character of the same function as IS COMMON.

If Fred decides not to do that's ok, I have to accept it.

But you don't tell me about workarounds or your wisdom concerning "C" etc.

If you like workarounds so much, why not go back to real pure BASIC and fiddle workarounds yourself for any addon?

What I wanted to say is: like my topic, how short and clear and objectiv could a forum be, if those members I've tried to describe above, would keep silent and answer only if they really know an answer!

Ok, That's my last reply to this topic. But I just had to get that off!

../tomio

Posted: Mon Sep 01, 2008 11:21 pm
by ts-soft
the wish is already here:
http://www.purebasic.fr/english/viewtop ... ght=escape
http://www.purebasic.fr/english/viewtop ... ght=escape
http://www.purebasic.fr/english/viewtop ... ght=escape
and some more ...

the first wish of this is older than 7 years, so it is normal, that some body
give you a workaround, otherwise I do not understand that you repeat to
these wish