Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2006-03

space char inside identifier's name

25 messages · 12 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bisma Jayadi

After trying out Morfix for some hours, I found very interesting "feature" of the implemented object Pascal language. Morfix Pascal allows space char within the identifier's name. If space char is used, then the name MUST BE enclosed within a double-quote char pair. Here are some examples:

type "Main Form": TForm;
var "this is a integer variable": integer;
if "Main Form".Left = 10 then ...
procedure "Main Form"."Edit Change"(Event: TDOMEvent);

I think this is a interesting feature to be supported. Though this is not too essential, but sometimes it is required or demanded. At least if we want FPC more Morfix "compatible". I know it looks more VB-ish or MS-ish, but if it is good, why not? :)

The implementation of it in the compiler is not too difficult, IMO. Some RTL source code modification is required though. CMIIW. :)

What's your opinion?

-Bee-

has Bee.ography at
http://beeography.wordpress.com

Reply by email

Vincent Snijders
to Bisma Jayadi
Bisma Jayadi wrote 13 lines
After trying out Morfix for some hours, I found very interesting "feature" of the implemented object Pascal language. Morfix Pascal allows space char within the identifier's name. If space char is used, then the name MUST BE enclosed within a double-quote char pair. Here are some examples: type "Main Form": TForm; var "this is a integer variable": integer; if "Main Form".Left = 10 then ... procedure "Main Form"."Edit Change"(Event: TDOMEvent); I think this is a interesting feature to be supported. Though this is not too essential, but sometimes it is required or demanded.

I cannot imagine situations where it would be required or demanded (maybe desirable, but I don't so). In what cases would it be required or demanded?

Vincent

Reply by email

Christian Iversen
to Bisma Jayadi
Bisma Jayadi wrote 7 lines
> WWWHHHAAAAAAAA! *Falls off chair* > *grabs desk* *pulls up* > Clear enough ? ;-) Same respond when the first time I knew that file name is case-sensitive in un*x-like OSes (Linux, etc). It looks silly and ridicilous (especially for M$ users), but most people still use it (the users like it even more). :P

But this is a lot more silly. There's \" everywhere!

Regards, Christian Iversen

Reply by email

Dr. Karl-Michael Schindler
to Micha Nelissen: On Sat, 25 Mar 2006 15:21:38 +0700 WWWHHHAAAAAAAA! *Falls off chair* *grabs desk* *pulls…

Hi

Micha Nelissen wrote 15 lines
On Sat, 25 Mar 2006 15:21:38 +0700 Bisma Jayadi wrote: > type "Main Form": TForm; > var "this is a integer variable": integer; > if "Main Form".Left = 10 then ... > procedure "Main Form"."Edit Change"(Event: TDOMEvent); WWWHHHAAAAAAAA! *Falls off chair* *grabs desk* *pulls up* Clear enough ? ;-) Micha

I understand your reaction, in particular with the examples above. But from own experience I have an argument in favor of less strict naming conventions:

I coded a lot in a macro language, which had similar naming conventions as Pascal. In one revision they were lifted and examples like the above became possible, but not used as expected. However, some things were used a lot:

Names starting with a number and using "-" instead of "_".

Based on this examples from practice, I would suggest to consider it again.

Michael

Reply by email

Bisma Jayadi
to Vincent Snijders: I cannot imagine situations where it would be required or demanded (maybe desirable, but…
I cannot imagine situations where it would be required or demanded (maybe desirable, but I don't so). In what cases would it be required or demanded?

Say I'm gonna make some kind of game maker application, where user can create game objects. It sure the game objects need name as their identifier. For ease of use, I can make object's name more space-char-friendly because the user of the application is not always a programmer (they even can't understand why an object's name can't accept space char).

If the compiler supports space char inside identifier's name, I don't need to do some kind of convertion from game maker object's name to internal game maker identifier's name because I can grab it directly from the application. Of course, I can translate game maker objects name into Object1 to ObjectN, but it's not favorable. :)

-Bee-

has Bee.ography at
http://beeography.wordpress.com

Reply by email

Christian Iversen
to Bisma Jayadi
Bisma Jayadi wrote 5 lines
> But this is a lot more silly. There's \" everywhere! What's wrong with " char? We use := and ; almost in every single line of code. And the IDE should able to do it for us, that's what code completion is made for. :p
"Foo a"."bar a" := "baz b"[4]."foo q"

is harder to read! It's not the char itself, it's that it's used all over the place whenever this is used. I don't like it.

Regards, Christian Iversen

Reply by email

Bisma Jayadi
to Christian Iversen
"Foo a"."bar a" := "baz b"[4]."foo q"

You made a very excessive example. Of course we don't HAVE TO use space char all the times. I won't use it that way either. But it's there when we really want/need it.

is harder to read! It's not the char itself, it's that it's used all over the place whenever this is used. I don't like it.

Maybe you don't like it and that's alright. This feature won't harm you in any ways. But some other people could demand it in some circumstances.

-Bee-

has Bee.ography at
http://beeography.wordpress.com

Reply by email

���� ����������� � mail.ru
to Christian Iversen: "Foo a"."bar a" := "baz b"[4]."foo q" is harder to read! It's not the char itself, it's…

Saturday, March 25, 2006, 1:08:02 PM:

CI> "Foo a"."bar a" := "baz b"[4]."foo q"

CI> is harder to read! It's not the char itself, it's that it's used all over the CI> place whenever this is used. I don't like it.

It doesn't look like joke anymore, so I ask: in what aspect (except double double quotes) the space sign is different from the underline sign?

And if it is, why don't use arbitrary length names with carriage returns, pictures, music and videos: just use url as the name... (fast connection required for compiling)

---------------

Reply by email

Marco van de Voort
to Bisma Jayadi: After trying out Morfix for some hours, I found very interesting "feature" of the…
type "Main Form": TForm; var "this is a integer variable": integer; if "Main Form".Left = 10 then ... procedure "Main Form"."Edit Change"(Event: TDOMEvent);

Not this millenium, and probably not the next also.

Moreover, it is not even needed to pull this in syntax. Just make the underscore really thin in your IDE, but make it very visible when selected, and you have the same visual effect. Better even, since you don't need the quotes.

Reply by email

Marco van de Voort
to Dr. Karl-Michael Schindler: Hi I understand your reaction, in particular with the examples above. But from own…
Show quoted text 5 lines
conventions as Pascal. In one revision they were lifted and examples like the above became possible, but not used as expected. However, some things were used a lot: Names starting with a number and using "-" instead of "_".

The real big question of course is _WHY_ in earths name would they do that? And even if one would think creating a language is equal to a generalising feature creep, and one would throw readability as argument out of the window, is it really worth quoting all identifiers (if mandatory), and the confusion if it isn't to be able to have leading numbers in identifiers?

(btw
There is a simple faq btw about extensions, things to do before suggesting a language feature.

http://www.freepascal.org/faq.html#extensionselect

Specially point 2.
)

Reply by email

Johann Glaser
to Bisma Jayadi: You made a very excessive example. Of course we don't HAVE TO use space char all the…

Hi!

Bisma Jayadi wrote 11 lines
> "Foo a"."bar a" := "baz b"[4]."foo q" You made a very excessive example. Of course we don't HAVE TO use space char all the times. I won't use it that way either. But it's there when we really want/need it. > is harder to read! It's not the char itself, it's that it's used all over the > place whenever this is used. I don't like it. Maybe you don't like it and that's alright. This feature won't harm you in any ways. But some other people could demand it in some circumstances.

That is wrong. If the possibility exists, it will be used (at least in some cases by some people). In many cases this code will have to be maintained by different people too. There will be guys which can't stand this kind of identifiers but they are forced to use it. So this "feature" renders to a limitation of freedom and productivity of programmers.

The proposed idea has big drawbacks:
- code gets unreadable and unmaintainable (eye-ball search for mating '"' chars, finding seperations between identifiers)
- the linker doesn't support special chars inside variable names so automatic name manging would be necessary
- people are stimulated to use identifiers in their natural language instead of short and pregnant keywords
- somebody could have the idea to demand Unicode characters inside identifiers, cooperative software development (as widely exercised in Open Source and Free Software development) across different countries and languages comes to a stagnation due to lack of available characters on the programmer's keyboards (or could you write German äöüÄÖÜß, or even Russian cyrillic letters without painful tricks?)
- create heavy incompatibilities with Delphi, Turbo Pascal, ...
- and finally, a personal argument: The professional programming language Pascal is shifted towards kiddies and wannabe programmers and I personally want to prevent that FreePascal resembles Visual Basic or other language for blowhards.

For your game maker application (which is intended for kiddies and wannabies, I guess), do the name mangling in your application and let the compiler and underlying language be a tool for professionals.

Bye
Hansi

Reply by email

Christian Iversen
to Bisma Jayadi: You made a very excessive example. Of course we don't HAVE TO use space char all the…
Bisma Jayadi wrote 5 lines
> "Foo a"."bar a" := "baz b"[4]."foo q" You made a very excessive example. Of course we don't HAVE TO use space char all the times. I won't use it that way either. But it's there when we really want/need it.

Can you please make an example where we _need_ it? :-)

Show quoted text 5 lines
> is harder to read! It's not the char itself, it's that it's used all over > the place whenever this is used. I don't like it. Maybe you don't like it and that's alright. This feature won't harm you in any ways. But some other people could demand it in some circumstances.

That's not true. I have to work with the code other people produce, and this is a huge step towards making that code potentially unreadable.

Regards, Christian Iversen

Reply by email

Bisma Jayadi
to ���� ����������� � mail.ru: Saturday, March 25, 2006, 1:08:02 PM: CI> "Foo a"."bar a" := "baz b"[4]."foo q" CI> is…
It doesn't look like joke anymore, so I ask: in what aspect (except double double quotes) the space sign is different from the underline sign?

In most cases when we write codes by hand, I know this feature is almost useless. But for automated or generated codes like example I had given in another email, this feature will help alot.

And if it is, why don't use arbitrary length names with carriage returns, pictures, music and videos: just use url as the name... (fast connection required for compiling)

You don't need to hyperbola my suggestion. Everybody knows we don't need those inside an identifier name, those are not even a name by the way. Name is a text, and most people (except programmers) can't understand why a space char can't be accepted as part of a name.

This is just a suggestion anyway, it means can be accepted or rejected. I can accept any conclusion/decision from the FPC core development team. So, you don't need to over-react your responds. Just give your reasonable arguments, no matter you're agree or disagree with me. :)

-Bee-

has Bee.ography at
http://beeography.wordpress.com

Reply by email

Jonas Maebe
to Johann Glaser: Hi! That is wrong. If the possibility exists, it will be used (at least in some cases by…
Johann Glaser wrote 11 lines
- people are stimulated to use identifiers in their natural language instead of short and pregnant keywords - somebody could have the idea to demand Unicode characters inside identifiers, cooperative software development (as widely exercised in Open Source and Free Software development) across different countries and languages comes to a stagnation due to lack of available characters on the programmer's keyboards (or could you write German äöüÄÖÜß, or even Russian cyrillic letters without painful tricks?)

I think it would be useful to allow this (although I don't see myself implementing support for it). Especially in educational contexts, where the users don't necessarily know English (yet), this provides much added value. Also in projects where not everyone speaks English but e.g. Spanish, French or even Chinese, this can be very useful.

Currently, they also name their variables and procedures in their native languages, just without accents etc (and that's possibly even less readable for a non-native speaker than in case the names would be syntactically correct -- e.g. in Polish you have the l and the ł, but in identifier names that all becomes l and you can guess which is the correct character if you don't know the word).

- create heavy incompatibilities with Delphi, Turbo Pascal, ...

FPC already supports plenty of things which are quite incompatible with Delphi and TP.

- and finally, a personal argument: The professional programming language Pascal is shifted towards kiddies and wannabe programmers and I personally want to prevent that FreePascal resembles Visual Basic or other language for blowhards.

I don't see at all how identifier naming has anything to do with the "professionalism" of a language. You have wannabe programmers in pretty much every language out there (except maybe in languages like BrainF*ck and Whitespace), and when I started with Pascal I was a "kiddie" too (13-14 years).

Jonas

Reply by email

Bisma Jayadi
to Johann Glaser: Hi! That is wrong. If the possibility exists, it will be used (at least in some cases by…
Show quoted text 6 lines
That is wrong. If the possibility exists, it will be used (at least in some cases by some people). In many cases this code will have to be maintained by different people too. There will be guys which can't stand this kind of identifiers but they are forced to use it. So this "feature" renders to a limitation of freedom and productivity of programmers.

I believe the possibility does always exist, since some language does allow it. But not in very much demanded though.

Show quoted text 14 lines
The proposed idea has big drawbacks: - code gets unreadable and unmaintainable (eye-ball search for mating '"' chars, finding seperations between identifiers) - the linker doesn't support special chars inside variable names so automatic name manging would be necessary - people are stimulated to use identifiers in their natural language instead of short and pregnant keywords - somebody could have the idea to demand Unicode characters inside identifiers, cooperative software development (as widely exercised in Open Source and Free Software development) across different countries and languages comes to a stagnation due to lack of available characters on the programmer's keyboards (or could you write German äöüÄÖÜß, or even Russian cyrillic letters without painful tricks?) - create heavy incompatibilities with Delphi, Turbo Pascal, ...

Very good reasonable points! I never think about these drawbacks before, especially about the incompatibility issue. Compatibility is one point I like from FPC so I still able to compile my codes in other pascal compilers. :) I agree with you, my suggestion has lots more disadvantages than the advantages.

Thank you. :)

- and finally, a personal argument: The professional programming language Pascal is shifted towards kiddies and wannabe programmers and I personally want to prevent that FreePascal resembles Visual Basic or other language for blowhards.

I don't agree with this. But I don't need to discuss more about this since it'd be out of the topic. :)

-Bee-

has Bee.ography at
http://beeography.wordpress.com

Reply by email

Danny Milosavljevic
to Bisma Jayadi: Same respond when the first time I knew that file name is case-sensitive in un*x-like…

Hi,

Bisma Jayadi wrote 7 lines
> WWWHHHAAAAAAAA! *Falls off chair* > *grabs desk* *pulls up* > Clear enough ? ;-) Same respond when the first time I knew that file name is case-sensitive in un*x-like OSes (Linux, etc). It looks silly and ridicilous (especially for M$ users), but most people still use it (the users like it even more). :P

Who likes that? I thought it was just for POSIX compability and that every single app works around it anyways so user doesn't have to cope with that :-> (i.e. bash's ignore-case, filedialogs that couldn't care less about case, ....)

If a filesystem type appears with case-insensitive names, I'm the first one to switch my home directory to it, non-standard or not...

The only reason file names are case sensitive on UNIX is because those deluded souls don't even want the OS/anyone to know what charset encoding the file names *are* in. It's been basically guesswork to find out. Once the OS isn't "supposed" to know the encoding of it's own names, it just goes downwards from there.
That's changing nowadays since most UNIXes are switching the filesystem name encoding to UTF-8. The standard still demands OS stupidity though.

And about spaces in identififers, that makes the code unreadable (i's a problem for the eye). SQL has it too, and there it makes the code unreadable as well. If you can, try using them in MSAccess or MSSQL Server and later try to read some complex SQL query that uses them. It's the height of unreadability.

That's what underscores are for: "spaces" in identifiers (or "-" in some programming languages).

And if your argument is that they don't "have" to be used by everyone / everywhere, then I say that's even worse: having no clear naming conventions hurts maintainability and frustrates everyone.

As you can see I'm in favour of (bondage and) discipline :)

cheers,
Danny

Reply by email

Felipe Monteiro de Carvalho
to Bisma Jayadi: Same respond when the first time I knew that file name is case-sensitive in un*x-like…
Bisma Jayadi wrote
Same respond when the first time I knew that file name is case-sensitive in un*x-like OSes (Linux, etc). It looks silly and ridicilous (especially for M$ users), but most people still use it (the users like it even more). :P

I´m not sure about that. I´ve introduced a lot of people to Linux and no one said: I love case-insensitive names!!! Yuuupiii!!! Now I can have Makefile and makefile on the same dir!!!

It´s also a nightmare to find filenames. Some files have qt on the middle of the name, others have Qt. There are tons of other examples.

Also, when I talk to experienced unix users they all say to me: Please, put all your files and directories on lowercase and please never use spaces. You are asking for trouble.

Felipe Monteiro de Carvalho

Reply by email

Dr. Karl-Michael Schindler
to Danny Milosavljevic: Who likes that? I thought it was just for POSIX compability and that every single app…

Hi

a thought regarding the dependence of readability and restrictions. The argument that lifting the restrictions and leave the responsibility about readability to the programmer would ruin it, disregards that even the restrictions in place now do NOT prevent a programmer from using hard to read or hard to distinguish names. Think of two variables named:

j32ilh2k3q74 and j32lih2k3q74

So, the reason, why you hardly see such names (except in Fortran numerical code (:-) is that most (in particular Pascal-) programmers are aware of the connection between naming and readability. The extent is clearly different between different people and whether the pro developers (being paid for coding) do better than hobby programmers is another topic.

I found it just very convenient to reflect filenames in variables and the naming restrictions on filenames are more relaxed than on Pascal identifiers, even in unix.

Furthermore, I suggest to demangle the topic. Their are easy to separate topics, that can be discussed separately.

- lowercase/uppercase sensitivity
- allowing other characters than '_', all printable and within 7bit ASCII, such as '-', '%',..
- although space would be included in the above, it is somewhat special regarding readability.
- relaxing the restriction on the first character.
- mandatory quotation or not
- allowing 8bit ascii or unicode

Reply by email

Michael Van Canneyt
to Bisma Jayadi: After trying out Morfix for some hours, I found very interesting "feature" of the…
Bisma Jayadi wrote 14 lines
After trying out Morfix for some hours, I found very interesting "feature" of the implemented object Pascal language. Morfix Pascal allows space char within the identifier's name. If space char is used, then the name MUST BE enclosed within a double-quote char pair. Here are some examples: type "Main Form": TForm; var "this is a integer variable": integer; if "Main Form".Left = 10 then ... procedure "Main Form"."Edit Change"(Event: TDOMEvent); I think this is a interesting feature to be supported. Though this is not too essential, but sometimes it is required or demanded. At least if we want FPC more Morfix "compatible". I know it looks more VB-ish or MS-ish, but if it is good, why not? :)

In my personal opinion:

It is not good. It's a totally useless "feature". It has no additional value, because end users are not confronted with it anyway, and programmers should know better than to use spaces in identifiers. It makes code harder to read, at best.

Michael.

Reply by email

Michael Van Canneyt
to Bisma Jayadi: Say I'm gonna make some kind of game maker application, where user can create game…
Bisma Jayadi wrote 9 lines
> I cannot imagine situations where it would be required or demanded > (maybe desirable, but I don't so). In what cases would it be required or > demanded? Say I'm gonna make some kind of game maker application, where user can create game objects. It sure the game objects need name as their identifier. For ease of use, I can make object's name more space-char-friendly because the user of the application is not always a programmer (they even can't understand why an object's name can't accept space char).

In that case code a 'Name' property. The class will have a reagular identifier, but the name property can contain anything you need.

Michael.

Reply by email

Danny Milosavljevic
to Felipe Monteiro de Carvalho: By the way, how do other languages deal with identifiers on languages other then english?…

Hi,

Am Samstag, den 25.03.2006, 09:24 -0300 schrieb Felipe Monteiro de Carvalho:

Hello, By the way, how do other languages deal with identifiers on languages other then english?

C: unsupported
python: unsupported
perl: unsupported
common lisp: supports _anything_ as a name :)
ruby: supported with -K option
C#: unsupported
Java: unicode support
SQL: sometimes supported
Fortran77: only ascii letters and digits

cheers,
Danny

Reply by email