dot within unit file name

classic Classic list List threaded Threaded
80 messages Options
1234
Reply | Threaded
Open this post in threaded view
|

dot within unit file name

Bee-6
Hi all,

Why cant FPC use unit that has (some) dot(s) within the file name? Can
FPC support it in the next release (2.2.2)?

Sometimes I need to have some units for example: unit1.ori.pas and
unit1.modif.pas, which I need to switch to one of them but never use
them both.

TIA.

-Bee-

has Bee.ography at:
http://beeography.wordpress.com
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: dot within unit file name

Michael Van Canneyt


On Fri, 18 Jan 2008, Bee wrote:

> Hi all,
>
> Why cant FPC use unit that has (some) dot(s) within the file name? Can FPC
> support it in the next release (2.2.2)?

No.

>
> Sometimes I need to have some units for example: unit1.ori.pas and
> unit1.modif.pas, which I need to switch to one of them but never use them

Use an underscore.

Michael.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: dot within unit file name

Vinzent Höfler
In reply to this post by Bee-6
On Friday 18 January 2008 11:16, Bee wrote:

> Why cant FPC use unit that has (some) dot(s) within the file name?
> Can FPC support it in the next release (2.2.2)?

Probably not. And if at all, it wouldn't accomplish what you want to do.

> Sometimes I need to have some units for example: unit1.ori.pas and
> unit1.modif.pas, which I need to switch to one of them but never use
> them both.

Then use the branch/switch feature of your favourite version control
system. That's one thing it was designed for.



Vinzent.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: dot within unit file name

Damien Gerard
In reply to this post by Bee-6

On Jan 18, 2008, at 11:16 AM, Bee wrote:

> Hi all,
>
> Why cant FPC use unit that has (some) dot(s) within the file name?  
> Can FPC support it in the next release (2.2.2)?
>

I think the dot is used in the grammar.
for example :


unit foo;
interface
procedure Print;
implementation
[...]
end.


You want to be able to call foo.Print;  and you can not make the  
difference between a dot for the filename and a dot as a separator.


> Sometimes I need to have some units for example: unit1.ori.pas and  
> unit1.modif.pas, which I need to switch to one of them but never use  
> them both.
>
> TIA.



--
Damien Gerard
[hidden email]

Le temps n'a pas d'importance. Seul le code est important
    -- (f00ty)




_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: dot within unit file name

Bee-6
In reply to this post by Vinzent Höfler
> Probably not. And if at all, it wouldn't accomplish what you want to do.

If someone would provide a patch for this, is it gonna be accepted? If
not, may I know what the reason(s)? ;)

> Then use the branch/switch feature of your favourite version control
> system. That's one thing it was designed for.

For some reasons, sometimes version control is too bloated, especially
when the project is not too big. Nevertheless, it's the easiest way to
have "manual" version control. :D

-Bee-

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

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: dot within unit file name

Bee-6
In reply to this post by Damien Gerard
> I think the dot is used in the grammar.

I understand.

> You want to be able to call foo.Print;  and you can not make the
> difference between a dot for the filename and a dot as a separator.

I believe the compiler has some kind of unit list. Compiler should know
the difference using some kind of specific logic.

I used to use this feature on Turbo Delphi Explorer. But since I totally
switch to FPC/Laz and Ubuntu, I really missed this feature on FPC. :(

-Bee-

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

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: dot within unit file name

ik-6
In reply to this post by Bee-6
On Jan 18, 2008 12:34 PM, Bee <[hidden email]> wrote:
> > Probably not. And if at all, it wouldn't accomplish what you want to do.
>
> If someone would provide a patch for this, is it gonna be accepted? If
> not, may I know what the reason(s)? ;)

unit_name.function (....) ...
...

How would you coap with this situation if you'll have "." inside ?
You can translate it into "_", yes, or you can just use underscore at
the file name at the first place...

Personally I do not want to see this feature in Pascal, because it
will just complicate things, because there is a use for dot in the
Pascal language...

>
> > Then use the branch/switch feature of your favourite version control
> > system. That's one thing it was designed for.
>
> For some reasons, sometimes version control is too bloated, especially
> when the project is not too big. Nevertheless, it's the easiest way to
> have "manual" version control. :D
>
> -Bee-
>
> has Bee.ography at:
> http://beeography.wordpress.com
>

Ido
--
http://ik.homelinux.org/
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: dot within unit file name

Michael Fuchs-5
In reply to this post by Bee-6
Bee schrieb:

> Why cant FPC use unit that has (some) dot(s) within the file name? Can
> FPC support it in the next release (2.2.2)?

I think more interesting are dots in unit name for making better namespaces.
If I have a class called TSpecialButton, I want a unit name like
"Michael.GUI.Buttons.TSpecialButton".

Or is there an other way to make namespaces like this?

Micha
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: dot within unit file name

Vinzent Höfler
In reply to this post by Bee-6
On Friday 18 January 2008 11:34, Bee wrote:

> For some reasons, sometimes version control is too bloated,
> especially when the project is not too big.

I used RCS on 2K SLOC projects years ago already and never found it to
be "too bloated". No, I could actually look at the change log and diffs
from weeks ago and see why the code was broken now.

> Nevertheless, it's the
> easiest way to have "manual" version control. :D

And about the most error-prone. Believe me, I speak from experience.

One of my co-workers used "manual" version control by renaming and
moving files around (and even now his code is on SVN, he still does
it - bad habits die hard, I guess).
No joke, but there was not one single version he had given me as "the
latest" which actually matched his "tested" development copy. Despite
all his effort[1], there were always "differences" and "bugs he already
fixed" appearing at the beta test site once I installed "the exact same
copy" of his development tree from his PC.



Vinzent.

[1] I'd rather be lazy than spending hours and hours finding out what
the hell went wrong. After all, my laziness lend me to believe that
software developer is the right profession for me. And so far, it
worked out for me. :)
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: dot within unit file name

Vinzent Höfler
In reply to this post by Bee-6
On Friday 18 January 2008 11:39, Bee wrote:

> I used to use this feature on Turbo Delphi Explorer. But since I
> totally switch to FPC/Laz and Ubuntu, I really missed this feature on
> FPC. :(

No offense, but maybe this is a good time to start becoming a serious
developer now?


Vinzent.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: dot within unit file name

Bee-6
In reply to this post by ik-6
> Personally I do not want to see this feature in Pascal, because it
> will just complicate things, because there is a use for dot in the
> Pascal language...

Feature is feature, you may use it, if you like, you may not, if you
don't. Doesn't need to make yourself got complicated. ;)

It's like the '='. It does not always mean 'equal' as you have to use it
on type declaration *and* comparison. It's like the 'end'. It does not
always need to have 'begin' since 'case' and 'try' can also have an
'end'. Etc. :)

-Bee-

has Bee.ography at:
http://beeography.wordpress.com
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: dot within unit file name

Vinzent Höfler
In reply to this post by Michael Fuchs-5
On Friday 18 January 2008 11:48, Michael Fuchs wrote:
> Bee schrieb:
> > Why cant FPC use unit that has (some) dot(s) within the file name?
> > Can FPC support it in the next release (2.2.2)?
>
> I think more interesting are dots in unit name for making better
> namespaces.

Actually, I'm thinking "child units".

"Namespaces" don't even have the appropriate scoping rules. The Java
language's package is a perfect example for that: No matter where you
put the class, it only sees it's own package. There they missed a
perfect opportunity to enforce scoping rules with the compiler instead
of letting the programmer decide it all over again just like they did
back in the 70s, where all programs were written in FORTRAN and never
crossed the 1023 lines of code boundary. ;)


Vinzent.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: dot within unit file name

Bee-6
In reply to this post by Vinzent Höfler
> No offense, but maybe this is a good time to start becoming a serious
> developer now?

No offense, but maybe this is a good time to start providing a serious
namespace to FPC now? ;)

-Bee-

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

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: dot within unit file name

Bee-6
In reply to this post by Michael Van Canneyt
> Use an underscore.

Ok, I need to learn a new habit then. I can live with that. Thanks,
Michael. :)

-Bee-

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

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: dot within unit file name

Matt Emson
In reply to this post by Vinzent Höfler
Vinzent Hoefler wrote:

> On Friday 18 January 2008 11:39, Bee wrote:
>
>  
>> I used to use this feature on Turbo Delphi Explorer. But since I
>> totally switch to FPC/Laz and Ubuntu, I really missed this feature on
>> FPC. :(
>>    
>
> No offense, but maybe this is a good time to start becoming a serious
> developer now?
>  

I think you are missing the point. Bee may indeed be misguided, but the
feature is in Delphi[.Net] in general. It is used to implement
Namespaces - something sadly lacking in the FPC dialect of Pascal. Maybe
it is time *you* embraced modern programming techniques? I, for one,
would rate Namespaces over templates and generics. I use them daily.
Give me partial classes too (i.e. OO modular design.)

M
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: dot within unit file name

Michael Van Canneyt
In reply to this post by Bee-6


On Fri, 18 Jan 2008, Bee wrote:

> > Use an underscore.
>
> Ok, I need to learn a new habit then. I can live with that. Thanks, Michael.
> :)

For clarity: I am not against this dot by itself. I can only assure you, if
implemented, that it will not end up in 2.2.2.

As for implementing this feature: this is not so trivial as one might think.

1. The parser needs changing. That's probably the easy part.

2. Symbol lookups need changing. This is the hard part, because you must be
   able to handle correctly unitname.identifier.identifier2.identifier3

   It doesn't take a lot of intelligence to see that if unitname can
   containe one (or more) dots, this mechanism becomes suddenly a lot harder
   because your unitname may, by accident, match unitname.identifier1 of
   a symbol in another unit.

And doing all this in a way that doesn't change current behaviour...
Not something you can do in a day, if you ask me.

Michael.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: dot within unit file name

Vinzent Höfler
In reply to this post by Matt Emson
On Friday 18 January 2008 12:01, Matt Emson wrote:

> Vinzent Hoefler wrote:
> > On Friday 18 January 2008 11:39, Bee wrote:
> >> I used to use this feature on Turbo Delphi Explorer. But since I
> >> totally switch to FPC/Laz and Ubuntu, I really missed this feature
> >> on FPC. :(
> >
> > No offense, but maybe this is a good time to start becoming a
> > serious developer now?
>
> I think you are missing the point.

No, I don't.

> Bee may indeed be misguided, but
> the feature is in Delphi[.Net] in general.

Screw Delphi. That "feature" was in ISO-standardized Ada back in 1995
already. And there it's called child units. Name spaces have too flat
scoping rules to be really useful.

And yes, I'd like to have implemented that ("child units") in FPC.

But even so, it still wouldn't help Bee, because he's not using it for
namespaces, he's using it as special names for version control. This
was the part I was attacking, if anyone else wondered.


Vinzent.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: dot within unit file name

Vinzent Höfler
In reply to this post by ik-6
On Friday 18 January 2008 11:44, ik wrote:

> Personally I do not want to see this feature in Pascal, because it
> will just complicate things, because there is a use for dot in the
> Pascal language...

Think "records".

If you can have "unit.identifier.record_field" ad infinitum (any record
may contain another record), it's not too far fetched to extend that
concept to "unit.sub_unit. ...".


Vinzent.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: dot within unit file name

Michael Fuchs-5
In reply to this post by Vinzent Höfler
Vinzent Hoefler schrieb:

>> I think more interesting are dots in unit name for making better
>> namespaces.
>
> Actually, I'm thinking "child units".
You mean like in Ada? Yes, this would be great.
Are there any plans to implement this in future versions?

Micha
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: dot within unit file name

Bee-6
In reply to this post by Vinzent Höfler
> And yes, I'd like to have implemented that ("child units") in FPC.

What is child unit?

> But even so, it still wouldn't help Bee, because he's not using it for
> namespaces, he's using it as special names for version control. This
> was the part I was attacking, if anyone else wondered.

It's alright. I can learn a new habit to use underscore instead of dot
since today. Yes, bad habits die hard! :-D It just looks cool to see my
unit like this: bee.buttons.myfancybutton; :-D

-Bee-

has Bee.ography at:
http://beeography.wordpress.com
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
1234