Hi!
Is it correct,that this code doesn't compile:
module foo;
struct Foo
{
private int bar;
alias bar this;
}
///
module main;
import foo;
void main()
{
Foo b;
int a = b;//Error:undefined identifier 'bar', did you mean
'template back(T) //if (!isN
On 12/25/2012 02:06 AM, Zhenya wrote:
Is it correct,that this code doesn't compile:
check this: http://dpaste.dzfl.pl/eec6d152
regards,
r_m_r
r_m_r:
check this: http://dpaste.dzfl.pl/eec6d152
D "private" is enforced only across distinct modules.
Bye,
bearophile
On 12/25/2012 06:09 AM, bearophile wrote:
D "private" is enforced only across distinct modules.
I've justed tested this and I think you're right (it seems a bit
counter-intuitive though ;-) ).
How about this:
//file: foo.d
module foo;
struct Foo
{
private int bar_;
@property int b
On 12/25/2012 07:42 AM, r_m_r wrote:
assert(!__traits(compiles, b._bar));
sorry, i made a typo: it should be bar_ instead of _bar.
Interestingly, the below assertion fails at run time:
assert(!__traits(compiles, b.bar_));
but this won't compile (as expected):
assert(b.bar_ == 20); //main.d
On Tuesday, 25 December 2012 at 02:43:52 UTC, r_m_r wrote:
On 12/25/2012 07:42 AM, r_m_r wrote:
assert(!__traits(compiles, b._bar));
sorry, i made a typo: it should be bar_ instead of _bar.
Interestingly, the below assertion fails at run time:
assert(!__traits(compiles, b.bar_));
but this
On Tuesday, 25 December 2012 at 02:43:52 UTC, r_m_r wrote:
On 12/25/2012 07:42 AM, r_m_r wrote:
assert(!__traits(compiles, b._bar));
sorry, i made a typo: it should be bar_ instead of _bar.
Interestingly, the below assertion fails at run time:
assert(!__traits(compiles, b.bar_));
but this
On 12/25/2012 10:53 AM, evilrat wrote:
i'm not D expert, but isn't the first statement(b.bar_) evaluated to
b.opCall(Foo.opCall)? so the first assert may be true in this case
i dunno. i'm no D expert either ;-)
BTW its interesting that while the following assertion fails at runtime:
assert(!_
On Tuesday, 25 December 2012 at 06:19:02 UTC, r_m_r wrote:
i dunno. i'm no D expert either ;-)
BTW its interesting that while the following assertion fails at
runtime:
assert(!__traits(compiles, b.bar_));
the assertion below executes without errors (as expected):
assert(!__traits(compiles,
On Tuesday, 25 December 2012 at 05:28:54 UTC, Zhenya wrote:
On Tuesday, 25 December 2012 at 02:43:52 UTC, r_m_r wrote:
On 12/25/2012 07:42 AM, r_m_r wrote:
assert(!__traits(compiles, b._bar));
sorry, i made a typo: it should be bar_ instead of _bar.
Interestingly, the below assertion fails a
On Tuesday, 25 December 2012 at 07:21:12 UTC, evilrat wrote:
On Tuesday, 25 December 2012 at 05:28:54 UTC, Zhenya wrote:
On Tuesday, 25 December 2012 at 02:43:52 UTC, r_m_r wrote:
On 12/25/2012 07:42 AM, r_m_r wrote:
assert(!__traits(compiles, b._bar));
sorry, i made a typo: it should be bar
11 matches
Mail list logo