Forum > General

[Solved] Are there any file naming rules to save ampersand prefixed units?

(1/7) > >>

WooBean:
As I checked in Delphi 2010 there was not possible to save a unit named like "&begin".

Some trials to cheat Delphi IDE by external renaming a file as "&begin.pas" or "begin.pas" were not successful.
Delphi always prevent using "reserved" word despite using "&" at the beginning of a unit name.

Current FPC and Lazarus seem to be more tolerant. It is possible to use a unit named "&begin" with corresponding file "begin.pas" or "&begin.pas".

Let us imagine that we are stating a rule which version should be implemented as default Lazarus IDE behaviour -
(1) save/rename to file with file name containg '&' prefix;
(2) save/rename to file with file name without '&' prefix.

My personal choice is version (1).

Maybe this was already decided somewhen?
 

440bx:
I think that if the ampersand appears in any occasion then it should always appear.

Consistency is important to ensure the file is always treated the same way which cannot be guaranteed if the ampersand in is significant in some situations and not in others.

my $0.02

ETA: edited typo

TRon:
Some filesystems/OS' do not allow an ampersand in a filename (or has a special meaning).

marcov:
I wouldn't recommend abusing &. It was meant for COM interfaces that are externally named, not as the end of keywords.

MarkMLl:

--- Quote from: marcov on August 16, 2024, 01:25:33 pm ---I wouldn't recommend abusing &. It was meant for COM interfaces that are externally named, not as the end of keywords.

--- End quote ---

I'd consider it to be extremely inadvisable, and would also advise extreme caution when choosing embedded separators.

Stick to "identifier style" filenames, i.e. start with a letter and continue with letters and/or digits. Use _ as a separator if you have to, avoid e.g. $ since even though it made sense on ISIS it's risky with anything more modern (i.e. just about anything)... same applies to &, quotes, slashes and so on.

Think carefully before using camelcase.

Subject to case significance/preservation and length limitations, the above should be good for most current OSes.

MarkMLl

Navigation

[0] Message Index

[#] Next page

Go to full version