Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
March 07, 2018 Can't "is null" an interface?!?! Incompatible types??? | ||||
---|---|---|---|---|
| ||||
--------------------- import vibe.core.net; TCPConnection mySocket; void main() { auto b = mySocket is null; } --------------------- That's giving me: --------------------- Error: incompatible types for (mySocket) is (null): TCPConnection and typeof(null) --------------------- WTF?!?! The type in question (vibe.core.net.TCPConnection) is an interface: http://vibed.org/api/vibe.core.net/TCPConnection https://github.com/vibe-d/vibe.d/blob/master/core/vibe/core/net.d#L344 The following works just fine: --------------------- interface IFoo {} void main() { IFoo i; auto b = i is null; } --------------------- |
March 08, 2018 Re: Can't "is null" an interface?!?! Incompatible types??? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nick Sabalausky (Abscissa) | On Thursday, 8 March 2018 at 04:48:08 UTC, Nick Sabalausky (Abscissa) wrote:
> ---------------------
> import vibe.core.net;
> TCPConnection mySocket;
>
> void main() {
> auto b = mySocket is null;
> }
> ---------------------
>
> That's giving me:
>
> ---------------------
> Error: incompatible types for (mySocket) is (null): TCPConnection and typeof(null)
> ---------------------
>
> WTF?!?!
>
> The type in question (vibe.core.net.TCPConnection) is an interface:
> http://vibed.org/api/vibe.core.net/TCPConnection
> https://github.com/vibe-d/vibe.d/blob/master/core/vibe/core/net.d#L344
>
> The following works just fine:
> ---------------------
> interface IFoo {}
>
> void main() {
> IFoo i;
> auto b = i is null;
> }
> ---------------------
That does seem odd.
---
/+dub.sdl:
dependency "vibe-d" version="~>0.8.3-alpha.1"
+/
import vibe.core.net;
import std.stdio;
TCPConnection mySocket;
void main() {
auto b = mySocket is null;
writeln(b);
}
---
works fine on run.dlang.io
|
March 08, 2018 Re: Can't "is null" an interface?!?! Incompatible types??? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nicholas Wilson | On 03/08/2018 01:13 AM, Nicholas Wilson wrote:
>
> That does seem odd.
> ---
> /+dub.sdl:
> dependency "vibe-d" version="~>0.8.3-alpha.1"
> +/
> import vibe.core.net;
> import std.stdio;
> TCPConnection mySocket;
>
> void main() {
> auto b = mySocket is null;
> writeln(b);
> }
> ---
> works fine on run.dlang.io
Interesting. I was using vibe.d 'v0.8.3-rc.1' (which doesn't appear to work on run.dlang.io). But it does seem to work for me if I use 'v0.8.3-alpha.1'.
I wonder what could have changed to result in this?
|
March 08, 2018 Re: Can't "is null" an interface?!?! Incompatible types??? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nick Sabalausky (Abscissa) | On 03/08/2018 03:04 AM, Nick Sabalausky (Abscissa) wrote: > > Interesting. I was using vibe.d 'v0.8.3-rc.1' (which doesn't appear to work on run.dlang.io). But it does seem to work for me if I use 'v0.8.3-alpha.1'. > > I wonder what could have changed to result in this? https://github.com/vibe-d/vibe.d/issues/2108 |
March 08, 2018 Re: Can't "is null" an interface?!?! Incompatible types??? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nick Sabalausky (Abscissa) | On Thursday, 8 March 2018 at 08:04:54 UTC, Nick Sabalausky (Abscissa) wrote: > Interesting. I was using vibe.d 'v0.8.3-rc.1' (which doesn't appear to work on run.dlang.io). But it does seem to work for me if I use 'v0.8.3-alpha.1'. > > I wonder what could have changed to result in this? It's a struct in "v0.8.3-rc.1" [1]. In "v0.8.3-rc.1" the new vibe-core package is the default configuration. [1] https://github.com/vibe-d/vibe-core/blob/master/source/vibe/core/net.d#L467 -- /Jacob Carlborg |
Copyright © 1999-2021 by the D Language Foundation