Re: Is this a bug?

2014-04-29 Thread Andrey via Digitalmars-d-learn
btw, short a,b,c; a = b + c; //error: cannot implicitly convert expression of type 'int' to 'short' Guys!! Tell me that I have an old slutty version of the compiler...

Re: Is this a bug?

2014-04-29 Thread John Colvin via Digitalmars-d-learn
On Tuesday, 29 April 2014 at 06:13:52 UTC, Andrey wrote: Ok, thanks a lot.. About dynamic arrays: I haven't found any information about internal representation of the D structures. E.g. do dynamic arrays have reference counter? Nevermind, I'm gonna use Type2[0] syntax. D dynamic arrays (be

Re: Is this a bug?

2014-04-29 Thread via Digitalmars-d-learn
On Tuesday, 29 April 2014 at 07:43:55 UTC, Andrey wrote: btw, short a,b,c; a = b + c; //error: cannot implicitly convert expression of type 'int' to 'short' Guys!! Tell me that I have an old slutty version of the compiler... No, it's correct. `b + c` is not guaranteed to fit into `a`, th

Re: import with renaming and public import inside module

2014-04-29 Thread ketmar via Digitalmars-d-learn
On Monday, 28 April 2014 at 15:57:16 UTC, anonymous wrote: `zmod.symbol` works, too. no, it's not. at least on latest GDC. I don't think so. The point of the renamed import is that you have to use the new name. but i renamed only my.module, not others. nothing hints me that renaming is SO glo

Re: import with renaming and public import inside module

2014-04-29 Thread bearophile via Digitalmars-d-learn
ketmar: so it's broken beyond any repair. so sad. The current implementation of the module system has some problems, that are being worked on. If you think some part of the module system design is not good enough, then try to ask for an enhancement :-) No need to be sad. Bye, bearophile

Re: Pointer to template types?

2014-04-29 Thread Chris via Digitalmars-d-learn
On Tuesday, 29 April 2014 at 04:44:39 UTC, Jesse Phillips wrote: On Monday, 28 April 2014 at 10:40:49 UTC, Chris wrote: Person!(string) *pptr; Just wanted to point out, the above is C style and not recommended. Person!(string)* pptr, pptr2, pptr3; In D the pointer is part of the type n

Re: import with renaming and public import inside module

2014-04-29 Thread Artur Skawina via Digitalmars-d-learn
On 04/29/14 11:57, ketmar via Digitalmars-d-learn wrote: > On Monday, 28 April 2014 at 15:57:16 UTC, anonymous wrote: >> `zmod.symbol` works, too. > no, it's not. at least on latest GDC. It certainly works here; if it didn't it would be a frontend problem. >> I don't think so. The point of the re

Re: import with renaming and public import inside module

2014-04-29 Thread bearophile via Digitalmars-d-learn
Artur Skawina: The D module system has a lot of problems and certainly needs to be completely redesigned from scratch, I don't think it will be redesigned from scratch (and if that happens I see no proof that the redesign will be better than the original design). So better to fix its major p

Re: import with renaming and public import inside module

2014-04-29 Thread anonymous via Digitalmars-d-learn
On Tuesday, 29 April 2014 at 09:57:08 UTC, ketmar wrote: On Monday, 28 April 2014 at 15:57:16 UTC, anonymous wrote: `zmod.symbol` works, too. no, it's not. at least on latest GDC. Works for me with Ubuntu's gdc 4.8.2-1ubuntu6. My little test case: my/module_.d: --- module my.module_; publi

Re: import with renaming and public import inside module

2014-04-29 Thread ketmar via Digitalmars-d-learn
On Tuesday, 29 April 2014 at 10:57:13 UTC, Artur Skawina via Digitalmars-d-learn wrote: The D module system has a lot of problems and certainly needs to be completely redesigned from scratch i don't see any real flaws in it. it's just little inconsistencies that can be easily fixed.

Re: import with renaming and public import inside module

2014-04-29 Thread ketmar via Digitalmars-d-learn
On Tuesday, 29 April 2014 at 10:44:44 UTC, bearophile wrote: The current implementation of the module system has some problems, that are being worked on. If you think some part of the module system design is not good enough, then try to ask for an enhancement :-) No need to be sad. ah, i can't

Re: import with renaming and public import inside module

2014-04-29 Thread ketmar via Digitalmars-d-learn
On Tuesday, 29 April 2014 at 11:10:06 UTC, anonymous wrote: Works for me with Ubuntu's gdc 4.8.2-1ubuntu6. ah, don't you believe that i *really tested* it before posting, with latest GDC from git (which i builds routinely on dayly basis)? Personally, I think the current behaviour is fine. Ren

Re: import with renaming and public import inside module

2014-04-29 Thread ketmar via Digitalmars-d-learn
On Tuesday, 29 April 2014 at 11:10:06 UTC, anonymous wrote: specifically, it was derelict sdl bindings. that module itself does public imports, so issue is more complicated. sorry for me being rude.

Re: import with renaming and public import inside module

2014-04-29 Thread bearophile via Digitalmars-d-learn
ketmar: ah, i can't clearly express myself even in this case, i don't think i can make clear request. it's easier to write code, not words. ;-) i'm sad not about D or module issues, i'm sad about myself. One of the most important skills of a programmer (and of course a technical/literary w

Re: import with renaming and public import inside module

2014-04-29 Thread anonymous via Digitalmars-d-learn
On Tuesday, 29 April 2014 at 11:23:56 UTC, ketmar wrote: ah, don't you believe that i *really tested* it before posting, with latest GDC from git (which i builds routinely on dayly basis)? You may have made mistakes when testing, or maybe I have. That's why I provided my testcase. Does it wor

Re: import with renaming and public import inside module

2014-04-29 Thread ketmar via Digitalmars-d-learn
On Tuesday, 29 April 2014 at 11:28:23 UTC, bearophile wrote: One of the most important skills of a programmer (and of course a technical/literary writer) is the ability to express ideas in written text. the thing is that English neither my native language nor i learned it in school (not really

Re: import with renaming and public import inside module

2014-04-29 Thread bearophile via Digitalmars-d-learn
ketmar: the thing is that English neither my native language Nor mine, as you can see :-) And I am bad with natural languages in general. But you can learn to write "acceptable" English if you do exercises for some years :-) Bye, bearophile

Re: import with renaming and public import inside module

2014-04-29 Thread ketmar via Digitalmars-d-learn
On Tuesday, 29 April 2014 at 11:47:07 UTC, anonymous wrote: You may have made mistakes when testing, or maybe I have. sorry again for being rude. i was really upset and unintentionally made it to you. That's why I provided my testcase. Does it work in your setup? your sample is ok. but dereli

Re: Is this a bug?

2014-04-29 Thread Steven Schveighoffer via Digitalmars-d-learn
On Tue, 29 Apr 2014 03:43:54 -0400, Andrey wrote: btw, short a,b,c; a = b + c; //error: cannot implicitly convert expression of type 'int' to 'short' Guys!! Tell me that I have an old slutty version of the compiler... No. It's due to integer promotion. All operations are done at the int

Re: import with renaming and public import inside module

2014-04-29 Thread Mike Parker via Digitalmars-d-learn
On 4/29/2014 8:25 PM, ketmar wrote: On Tuesday, 29 April 2014 at 11:10:06 UTC, anonymous wrote: specifically, it was derelict sdl bindings. that module itself does public imports, so issue is more complicated. sorry for me being rude. What, exactly, is the problem you are having with public imp

private constructors and inheritance

2014-04-29 Thread John Colvin via Digitalmars-d-learn
//blah1.d class A { private this(){} } //blah2.d import blah1; class B : A {} $ dmd blah1.d blah2.d -lib Error: constructor blah1.A.this is not accessible from module blah2 Can someone explain why this can't/doesn't work? Thanks.

Re: import with renaming and public import inside module

2014-04-29 Thread ketmar via Digitalmars-d-learn
On Tuesday, 29 April 2014 at 13:53:58 UTC, Mike Parker wrote: What, exactly, is the problem you are having with public imports in Derelict? it's not derelict issue, sorry is i made you to think that. issue is with the renamed public imports, and dereclit was one that triggered it. nothing bad w

Re: private constructors and inheritance

2014-04-29 Thread John Colvin via Digitalmars-d-learn
On Tuesday, 29 April 2014 at 13:59:30 UTC, John Colvin wrote: //blah1.d class A { private this(){} } //blah2.d import blah1; class B : A {} $ dmd blah1.d blah2.d -lib Error: constructor blah1.A.this is not accessible from module blah2 Can someone explain why this can't/doesn't work?

Re: import with renaming and public import inside module

2014-04-29 Thread ketmar via Digitalmars-d-learn
On Tuesday, 29 April 2014 at 13:53:58 UTC, Mike Parker wrote: ah. besides that i was once unable to build derelict sdl due to undefined symbols like 'ipad' or so, can't really remember. but it's the thing you got when goind bleeding edge, i think.

Re: private constructors and inheritance

2014-04-29 Thread Dicebot via Digitalmars-d-learn
http://dlang.org/class.html#constructors "If no call to constructors via this or super appear in a constructor, and the base class has a constructor, a call to super() is inserted at the beginning of the constructor." The fact that call to base constructor is not inserted into templated this

Re: private constructors and inheritance

2014-04-29 Thread Andrej Mitrovic via Digitalmars-d-learn
On 4/29/14, Dicebot via Digitalmars-d-learn wrote: > The fact that call to base constructor is not inserted into > templated this()() looks like a bug to me. Just found this, and it might be related: https://issues.dlang.org/show_bug.cgi?id=5770

Re: Is this a bug?

2014-04-29 Thread Ali Çehreli via Digitalmars-d-learn
On 04/29/2014 01:36 AM, John Colvin wrote: > D dynamic arrays (better referred to as slices) can be thought of as > implmented like > > struct Array(T) > { > T* ptr; > size_t length; > } > > They do not track ownership or have any reference counting. If they've > been allocated with "ne

Re: Is this a bug?

2014-04-29 Thread Meta via Digitalmars-d-learn
On Tuesday, 29 April 2014 at 16:52:27 UTC, Ali Çehreli wrote: That may be misleading because there is no need to allocate with an explicit new. For example, the slice below is owned by the GC as well: int[] foo() { int[] a; a ~= 42;// on memory owned by the GC return a; } I d

Socket server + thread: cpu usage

2014-04-29 Thread Tim via Digitalmars-d-learn
Hi guys, I've the following snipped: TcpSocket oSocket = new TcpSocket(AddressFamily.INET); oSocket.bind(new InternetAddress("127.0.0.1", 12345)); oSocket.blocking(false); oSocket.listen(0); while(true) { try { Socket oRequestSocket = oSocket.accept();

Re: Socket server + thread: cpu usage

2014-04-29 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 29 April 2014 at 17:16:33 UTC, Tim wrote: Is there anything I'm doing wrong? You should be using a blocking socket. With them, the operating system will put your thread on hold until a new connection comes in. Without them, it will endlessly loop doing absolutely nothing except c

Re: Socket server + thread: cpu usage

2014-04-29 Thread Tim via Digitalmars-d-learn
On Tuesday, 29 April 2014 at 17:19:41 UTC, Adam D. Ruppe wrote: On Tuesday, 29 April 2014 at 17:16:33 UTC, Tim wrote: Is there anything I'm doing wrong? You should be using a blocking socket. With them, the operating system will put your thread on hold until a new connection comes in. Withou

Re: Socket server + thread: cpu usage

2014-04-29 Thread Tim via Digitalmars-d-learn
On Tuesday, 29 April 2014 at 17:35:08 UTC, Tim wrote: On Tuesday, 29 April 2014 at 17:19:41 UTC, Adam D. Ruppe wrote: On Tuesday, 29 April 2014 at 17:16:33 UTC, Tim wrote: Is there anything I'm doing wrong? You should be using a blocking socket. With them, the operating system will put your

Re: Socket server + thread: cpu usage

2014-04-29 Thread Justin Whear via Digitalmars-d-learn
On Tue, 29 Apr 2014 17:16:32 +, Tim wrote: > Hi guys, > > I've the following snipped: > > TcpSocket oSocket = new TcpSocket(AddressFamily.INET); oSocket.bind(new > InternetAddress("127.0.0.1", 12345)); oSocket.blocking(false); > oSocket.listen(0); > > while(true) > { > try { >

Re: Is this a bug?

2014-04-29 Thread Ali Çehreli via Digitalmars-d-learn
On 04/29/2014 10:01 AM, Meta wrote: > On Tuesday, 29 April 2014 at 16:52:27 UTC, Ali Çehreli wrote: >> That may be misleading because there is no need to allocate with an >> explicit new. For example, the slice below is owned by the GC as well: >> >> int[] foo() >> { >> int[] a; a is an empt

Re: private constructors and inheritance

2014-04-29 Thread ketmar via Digitalmars-d-learn
On Tue, 29 Apr 2014 13:59:28 + John Colvin via Digitalmars-d-learn wrote: > Can someone explain why this can't/doesn't work? Thanks. hm. why it should? there is no 'default' constructors in D, and you specifially made explicit one private (i.e. not visible outside the module). and adding const

Re: private constructors and inheritance

2014-04-29 Thread Dicebot via Digitalmars-d-learn
On Tuesday, 29 April 2014 at 18:51:15 UTC, ketmar via Digitalmars-d-learn wrote: On Tue, 29 Apr 2014 13:59:28 + John Colvin via Digitalmars-d-learn wrote: Can someone explain why this can't/doesn't work? Thanks. hm. why it should? there is no 'default' constructors in D, and you specifia

Help plz: Using to libraries in D?

2014-04-29 Thread K.K. via Digitalmars-d-learn
Hi! I've kinda got a few noob questions... I've been trying to learn D for the last few months, and I've got a pretty good grasp of the syntax, but I've been having trouble figuring out how to use libraries(excluding the standard lib). I've been trying to setup a game engine, so I've tried li

Re: Help plz: Using to libraries in D?

2014-04-29 Thread K.K. via Digitalmars-d-learn
btw, please ignore my completely broken English in the title. Apparently I had a moment.

Re: Help plz: Using to libraries in D?

2014-04-29 Thread John Colvin via Digitalmars-d-learn
On Tuesday, 29 April 2014 at 20:55:01 UTC, K.K. wrote: Hi! I've kinda got a few noob questions... I've been trying to learn D for the last few months, and I've got a pretty good grasp of the syntax, but I've been having trouble figuring out how to use libraries(excluding the standard lib).

Re: import with renaming and public import inside module

2014-04-29 Thread ketmar via Digitalmars-d-learn
fuck. nobody approves my posts in mailing list. if i want to spam this forum — i can do it here. shit.

Re: Help plz: Using to libraries in D?

2014-04-29 Thread K.K. via Digitalmars-d-learn
On Tuesday, 29 April 2014 at 21:16:38 UTC, John Colvin wrote: I would recommend using dub for managing dependencies and building libraries etc. http://code.dlang.org/about Oh wow this looks awesome! I'll start messing around with it now - Thanks!

Re: import with renaming and public import inside module

2014-04-29 Thread ketmar via Digitalmars-d-learn
On Tuesday, 29 April 2014 at 21:21:10 UTC, ketmar wrote: bye. will never write here again.

VisualD Console App does not compile on default install VS 2010

2014-04-29 Thread markmnl via Digitalmars-d-learn
Platform: Windows 8.1 Update 1 After running the all-in-one Windows setup: dmd-2.065.0.exe, and creating a new D Console Application in VS 2010 then trying to build the application, the build fails with the below written to the buildlog.html. I can confirm writing the Tutorial's Hello World

Re: Is this a bug?

2014-04-29 Thread David Held via Digitalmars-d-learn
On 4/29/2014 10:01 AM, Meta wrote: On Tuesday, 29 April 2014 at 16:52:27 UTC, Ali Çehreli wrote: [...] int[] foo() { int[] a; a ~= 42;// on memory owned by the GC return a; } I didn't realize this was possible... I figured it was equivalent to `null ~= 42` which I realize now i