What difference between
if ((x = stdin.readln().chomp) is q)
and
if ((x = stdin.readln().chomp) == q)
?
On Tuesday, 4 February 2014 at 08:08:30 UTC, Suliman wrote:
What difference between
if ((x = stdin.readln().chomp) is q)
and
if ((x = stdin.readln().chomp) == q)
?
My interpretation of tdpl p57:
'is' compares for alias equality for arrays and classes.
Otherwise they are the same.
My interpretation of tdpl p57:
'is' compares for alias equality for arrays and classes.
Otherwise they are the same.
So should next code have same behavior if I will use is instead
of ==
import std.stdio;
import std.string;
void main()
{
getchar();
}
void getchar()
{
On Tuesday, 4 February 2014 at 08:25:18 UTC, Suliman wrote:
My interpretation of tdpl p57:
'is' compares for alias equality for arrays and classes.
Otherwise they are the same.
So should next code have same behavior if I will use is instead
of ==
import std.stdio;
import std.string;
void
Suliman:
What difference between
if ((x = stdin.readln().chomp) is q)
and
if ((x = stdin.readln().chomp) == q)
?
is performs a raw comparison of just the values, and the value
of a string is its ptr and length field. While == compares
their contents. So you want to use == here because you
Hi,
given a struct like so:
struct S(alias N, T) {...}
is there a way to get the template parameters of S? Something
like:
S.typetuple[0] == N,
S.typetuple[1] == T
I've had a look at std.typecons and std.typetuple but I don't see
what I'm missing something and cannot see a way to do the
On Tuesday, 4 February 2014 at 09:30:22 UTC, ed wrote:
Hi,
given a struct like so:
struct S(alias N, T) {...}
is there a way to get the template parameters of S? Something
like:
S.typetuple[0] == N,
S.typetuple[1] == T
I've had a look at std.typecons and std.typetuple but I don't
see
On Monday, 3 February 2014 at 20:10:59 UTC, Brenton wrote:
6) Any other comments or suggestions?
I know that the I'm learning the language factor plays a huge
role, but after you are done studying your vector implementation,
I think you could forget about it and use the ones provided by
On Tuesday, 4 February 2014 at 09:39:48 UTC, evilrat wrote:
On Tuesday, 4 February 2014 at 09:30:22 UTC, ed wrote:
Hi,
given a struct like so:
struct S(alias N, T) {...}
is there a way to get the template parameters of S? Something
like:
S.typetuple[0] == N,
S.typetuple[1] == T
I've had
…choose you favourite term.
Following on from trying to use D to write CPython extensions without
using PyD: entry points will be functions:
extern(C) type name() {
initializeIfNoAlreadyDone();
…
}
This immediately looks like a job for a Python decorator.
@pythonentry type name() {
…
}
On Tue, 2014-02-04 at 07:13 +, Artem Tarasov wrote:
On Sunday, 2 February 2014 at 15:31:30 UTC, Russel Winder wrote:
result is:
| LD_LIBRARY_PATH=. python execute.py
Segmentation fault
You should call Runtime.initialize() prior to calling any other D
functions.
On Tuesday, 4 February 2014 at 09:58:53 UTC, ed wrote:
On Tuesday, 4 February 2014 at 09:46:01 UTC, evilrat wrote:
On Tuesday, 4 February 2014 at 09:39:48 UTC, evilrat wrote:
On Tuesday, 4 February 2014 at 09:30:22 UTC, ed wrote:
Hi,
given a struct like so:
struct S(alias N, T) {...}
is
On Tuesday, 4 February 2014 at 09:30:22 UTC, ed wrote:
Hi,
given a struct like so:
struct S(alias N, T) {...}
is there a way to get the template parameters of S? Something
like:
S.typetuple[0] == N,
S.typetuple[1] == T
I've had a look at std.typecons and std.typetuple but I don't
see
On Tuesday, 4 February 2014 at 00:43:54 UTC, TheFlyingFiddle
wrote:
On Monday, 3 February 2014 at 10:25:19 UTC, Chris wrote:
Is there a way I can make the return type in getAttribute
generic? null does not work with numbers.
MyStruct(T) {
T[T] attributes;
//
public auto getAttribute(T
P.P.S. proof-of-concept implemenation of function attributes a
bit more similar t python decorators :
https://github.com/rejectedsoftware/vibe.d/blob/master/source/vibe/internal/meta/funcattr.d
On Tuesday, 4 February 2014 at 11:33:40 UTC, Russel Winder wrote:
The question is how to get this run.
Pointing out obvious things, part 2: wrap it into a C function
and call that function when loading the Python module.
library.d:
...
extern (C) export void attach() { Runtime.initialize();
I'm trying to find my own ip address using std.socket with little
success. How would i go about doing this? (It should be a
AddressFamily.INET socket)
On Tuesday, 4 February 2014 at 13:02:26 UTC, TheFlyingFiddle
wrote:
I'm trying to find my own ip address using std.socket with
little success. How would i go about doing this? (It should be
a AddressFamily.INET socket)
You can have lot of different local IP addresses on a single
machine so
On Tuesday, 4 February 2014 at 13:02:26 UTC, TheFlyingFiddle
wrote:
I'm trying to find my own ip address using std.socket with
little success. How would i go about doing this? (It should be
a AddressFamily.INET socket)
Create a connection to another LAN machine with a known address
(e.g.
On Tuesday, 4 February 2014 at 13:21:54 UTC, Stanislav Blinov
wrote:
Create a connection to another LAN machine with a known address
(e.g. gateway or router), then use Socket's localAddress
property to get your IP.
Worth noting that this solution is not reliable in general either
because
On Tuesday, 4 February 2014 at 13:13:07 UTC, Dicebot wrote:
On Tuesday, 4 February 2014 at 13:02:26 UTC, TheFlyingFiddle
wrote:
I'm trying to find my own ip address using std.socket with
little success. How would i go about doing this? (It should be
a AddressFamily.INET socket)
You can have
On Tuesday, 4 February 2014 at 13:21:54 UTC, Stanislav Blinov
wrote:
On Tuesday, 4 February 2014 at 13:02:26 UTC, TheFlyingFiddle
wrote:
I'm trying to find my own ip address using std.socket with
little success. How would i go about doing this? (It should be
a AddressFamily.INET socket)
On Tuesday, 4 February 2014 at 13:31:27 UTC, TheFlyingFiddle
wrote:
Problem is that i don't know in what local network the server
will be running, so this is unfortunatly not an option for me.
But if that's the case, the hostname solution may as well just
give you your loopback address. :)
On Tuesday, 4 February 2014 at 15:48:50 UTC, Vladimir Panteleev
wrote:
On Tuesday, 4 February 2014 at 13:02:26 UTC, TheFlyingFiddle
wrote:
I'm trying to find my own ip address using std.socket with
little success. How would i go about doing this? (It should be
a AddressFamily.INET socket)
On Tuesday, 4 February 2014 at 16:02:33 UTC, Craig Dillabaugh
wrote:
However if I run /sbin/ifconfig I get:
enp7s0Link encap:Ethernet HWaddr 50:E5:49:9B:29:49
inet addr:10.1.101.52 Bcast:10.1.101.255
Mask:255.255.255.0
inet6 addr: fe80::52e5:49ff:fe9b:2949/64
On Tuesday, 4 February 2014 at 13:02:26 UTC, TheFlyingFiddle
wrote:
I'm trying to find my own ip address using std.socket with
little success. How would i go about doing this? (It should be
a AddressFamily.INET socket)
This program will print all of your computer's IP addresses:
import
On Tuesday, 4 February 2014 at 16:13:33 UTC, Dicebot wrote:
It results in all addresses you hostname resolvs to. On all
desktop linux machines /etc/hosts is configured to resolve
hostname to localhost by default. On servers it usually
resolves to externally accessible one.
Update: I have
On Tue, 2014-02-04 at 12:45 +, Artem Tarasov wrote:
On Tuesday, 4 February 2014 at 11:33:40 UTC, Russel Winder wrote:
The question is how to get this run.
Pointing out obvious things, part 2: wrap it into a C function
and call that function when loading the Python module.
I had
On Tuesday, 4 February 2014 at 16:02:33 UTC, Craig Dillabaugh
wrote:
This computer is on a network with dynamically assigned IP
address (DHCP).
So shouldn't the 10.1.101.52 address have been reported?
Nope. In out-of-the-box simple network setups (i.e. home network
in the form PC/laptop -
On Tuesday, 4 February 2014 at 16:13:33 UTC, Dicebot wrote:
On Tuesday, 4 February 2014 at 16:02:33 UTC, Craig Dillabaugh
wrote:
However if I run /sbin/ifconfig I get:
enp7s0Link encap:Ethernet HWaddr 50:E5:49:9B:29:49
inet addr:10.1.101.52 Bcast:10.1.101.255
What does the alias attribute do here:
void foo(alias bar)
{
...
}
What is the idea behind this attribute when used here?
On Tuesday, 4 February 2014 at 17:09:02 UTC, Gary Willoughby
wrote:
What does the alias attribute do here:
void foo(alias bar)
This specifically won't compile, alias params are only allowed in
a compile-time list. So
void foo(alias bar)() { ... }
would work.
Anyway, what it does is
I have a C Struct:
typedef struct
{
enum LibRaw_image_formats type;
ushort height,
width,
colors,
bits;
unsigned int data_size;
unsigned char data[1];
}libraw_processed_image_t;
with a D
On 02/04/2014 10:58 AM, ollie wrote:
I have a C Struct:
[...]
uintdata_size;
ubyte[1]data;
Is that the C extension where the last array in a struct can have more
elements than its size? That will be a problem in D.
}
On Tue, 04 Feb 2014 03:08:28 -0500, Suliman everm...@live.ru wrote:
What difference between
if ((x = stdin.readln().chomp) is q)
and
if ((x = stdin.readln().chomp) == q)
?
The first compares the pointer of the arrays. The second compares the
contents of the array. Both check length as well
On Tuesday, 4 February 2014 at 17:17:13 UTC, Adam D. Ruppe wrote:
On Tuesday, 4 February 2014 at 17:09:02 UTC, Gary Willoughby
wrote:
What does the alias attribute do here:
void foo(alias bar)
This specifically won't compile, alias params are only allowed
in a compile-time list. So
On Tuesday, 4 February 2014 at 13:24:59 UTC, Dicebot wrote:
On Tuesday, 4 February 2014 at 13:21:54 UTC, Stanislav Blinov
wrote:
Worth noting that this solution is not reliable in general
either because your server can possibly have complicated routing
configurations that will make, for
On Tue, 04 Feb 2014 11:16:00 -0800, Ali Çehreli wrote:
Is that the C extension where the last array in a struct can have more
elements than its size? That will be a problem in D.
yes it is.
int[] D_slice = C_array[0 .. C_array_number_of_elements];
Thank you, that gives me what I was
Am Tue, 04 Feb 2014 16:19:08 +
schrieb Stanislav Blinov stanislav.bli...@gmail.com:
On Tuesday, 4 February 2014 at 16:02:33 UTC, Craig Dillabaugh
wrote:
This computer is on a network with dynamically assigned IP
address (DHCP).
So shouldn't the 10.1.101.52 address have been
On Tuesday, 4 February 2014 at 20:19:14 UTC, TheFlyingFiddle
wrote:
I'm setting up a simple local network enabling me to connect
phones to the computer through the local wi-fi. The simplest
way i could think of to make this work without relying on an
external server was to simply broadcast the
Ali Çehreli:
Is that the C extension where the last array in a struct can
have more elements than its size? That will be a problem in D.
Since V.2.065 D supports well variable-length structs. You have
to use ubyte[0] data, and then allocate a large enough memory for
the whole
On Tuesday, 4 February 2014 at 17:17:13 UTC, Adam D. Ruppe wrote:
This specifically won't compile, alias params are only allowed
in a compile-time list. So
void foo(alias bar)() { ... }
would work.
[...]
Thanks, Adam, for the thorough explanation. This was quite
helpful for me as well.
On Tuesday, 4 February 2014 at 00:04:23 UTC, Rene Zwanenburg
wrote:
On Monday, 3 February 2014 at 23:50:54 UTC, bearophile wrote:
Rene Zwanenburg:
The problem is speed. I'm using LockingTextReader in
std.stdio, but it't not nearly fast enough. On my system it
only reads about 3 MB/s with one
Parsing should be faster than I/O. Set up two buffers and have
one thread reading into buffer A while you parse buffer B with
a second thread.
...and then flip buffers whenever the slower of the two has
completed.
44 matches
Mail list logo