www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Should #line create a new namespace ?

reply Basile B. <b2.temp gmx.com> writes:
When the file is specified, Shouldn't #line create a new module ?

===========
module m;

int a;

#line 0 "other.d"

int a;
===========

Currently this is not allowed, but what's the value added by the 
filename then ?
Sep 24 2016
next sibling parent reply Dicebot <public dicebot.lv> writes:
 protected-headers="v1"
From: Dicebot <public dicebot.lv>
Newsgroups: d,i,g,i,t,a,l,m,a,r,s,.,D
Subject: Re: Should #line create a new namespace ?
References: <osenjmiqghdtpvdokabm forum.dlang.org>
In-Reply-To: <osenjmiqghdtpvdokabm forum.dlang.org>

--xKSBROOoIwhkRujRsh0pTaBoR8fN2QWlT
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 09/24/2016 10:14 AM, Basile B. wrote:
 When the file is specified, Shouldn't #line create a new module ?
=20
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 module m;
=20
 int a;
=20
 #line 0 "other.d"
=20
 int a;
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=20
 Currently this is not allowed, but what's the value added by the
 filename then ?
It was used to easier debug string mixins by changing their filename in reported errors. Now it is done by compiler by default and I don't know if any other use case remains. But is definitely is not intended to create a new module, D relies on strict 1-to-1 matching between files and modules. --xKSBROOoIwhkRujRsh0pTaBoR8fN2QWlT--
Sep 24 2016
parent reply Basile B. <b2.temp gmx.com> writes:
On Saturday, 24 September 2016 at 09:23:38 UTC, Dicebot wrote:
 On 09/24/2016 10:14 AM, Basile B. wrote:
 When the file is specified, Shouldn't #line create a new 
 module ?
 [...]
 Currently this is not allowed, but what's the value added by 
 the filename then ?
It was used to easier debug string mixins by changing their filename in reported errors. Now it is done by compiler by default and I don't know if any other use case remains. But is definitely is not intended to create a new module, D relies on strict 1-to-1 matching between files and modules.
Then I suggest to deprecate it. It was not totally illegitimate to think that it allows to create a new module. Also since no more special token sequence would exist in the language, special token sequence could be removed completely.
Sep 25 2016
next sibling parent reply Kagamin <spam here.lot> writes:
On Sunday, 25 September 2016 at 07:30:49 UTC, Basile B. wrote:
 Also since no more special token sequence would exist in the 
 language, special token sequence could be removed completely.
That's https://issues.dlang.org/show_bug.cgi?id=2660
Sep 26 2016
parent reply Basile B. <b2.temp gmx.com> writes:
On Monday, 26 September 2016 at 10:19:09 UTC, Kagamin wrote:
 On Sunday, 25 September 2016 at 07:30:49 UTC, Basile B. wrote:
 Also since no more special token sequence would exist in the 
 language, special token sequence could be removed completely.
That's https://issues.dlang.org/show_bug.cgi?id=2660
Yep, I also want an HackerPilot POV about this. He's the official guy for grammar stuff.
Sep 26 2016
parent Basile B. <b2.temp gmx.com> writes:
On Monday, 26 September 2016 at 11:37:51 UTC, Basile B. wrote:
 On Monday, 26 September 2016 at 10:19:09 UTC, Kagamin wrote:
 On Sunday, 25 September 2016 at 07:30:49 UTC, Basile B. wrote:
 Also since no more special token sequence would exist in the 
 language, special token sequence could be removed completely.
That's https://issues.dlang.org/show_bug.cgi?id=2660
Yep, I also want an HackerPilot POV about this. He's the official guy for grammar stuff.
To be clear, the problem is: if "SpecialTokenSequence" is removed naming, variable naming). Example: struct S{#i int;} would be be a struct declaration with an inside declaration.
Sep 26 2016
prev sibling parent Jonathan Marler <johnnymarler gmail.com> writes:
On Sunday, 25 September 2016 at 07:30:49 UTC, Basile B. wrote:
 On Saturday, 24 September 2016 at 09:23:38 UTC, Dicebot wrote:
 On 09/24/2016 10:14 AM, Basile B. wrote:
 When the file is specified, Shouldn't #line create a new 
 module ?
 [...]
 Currently this is not allowed, but what's the value added by 
 the filename then ?
It was used to easier debug string mixins by changing their filename in reported errors. Now it is done by compiler by default and I don't know if any other use case remains. But is definitely is not intended to create a new module, D relies on strict 1-to-1 matching between files and modules.
Then I suggest to deprecate it. It was not totally illegitimate to think that it allows to create a new module.
+1 (It also doesn't jive with the __FILE_FULL_PATH__ intrinsic)
Sep 26 2016
prev sibling parent Bauss <jj_1337 live.dk> writes:
On Saturday, 24 September 2016 at 07:14:47 UTC, Basile B. wrote:
 When the file is specified, Shouldn't #line create a new module 
 ?

 ===========
 module m;

 int a;

 #line 0 "other.d"

 int a;
 ===========

 Currently this is not allowed, but what's the value added by 
 the filename then ?
Debugging in mixins is the usage of it.
Sep 24 2016