another wish for escape character "\"

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Tomio
Enthusiast
Enthusiast
Posts: 291
Joined: Sun Apr 27, 2003 4:54 pm
Location: Germany

another wish for escape character "\"

Post 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
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

You could also use custom escape string functions : http://www.purebasic.fr/german/viewtopic.php?t=11858
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Tomio
Enthusiast
Enthusiast
Posts: 291
Joined: Sun Apr 27, 2003 4:54 pm
Location: Germany

Post 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
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post 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 :-)
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post 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...
oh... and have a nice day.
Tomio
Enthusiast
Enthusiast
Posts: 291
Joined: Sun Apr 27, 2003 4:54 pm
Location: Germany

Post 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
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post 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:
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
Tomio
Enthusiast
Enthusiast
Posts: 291
Joined: Sun Apr 27, 2003 4:54 pm
Location: Germany

Post 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]
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post 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.
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post 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 :-))
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post 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 ....?
Last edited by Kaeru Gaman on Mon Sep 01, 2008 7:11 pm, edited 1 time in total.
oh... and have a nice day.
User avatar
Demivec
Addict
Addict
Posts: 4260
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Post 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:
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Please calm down, it's just a feature request.
Tomio
Enthusiast
Enthusiast
Posts: 291
Joined: Sun Apr 27, 2003 4:54 pm
Location: Germany

Post 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
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post 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
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
Post Reply