Code:
import std.stdio;
struct Bar {
int payload;
alias payload this;
}
struct Foo {
private {
Bar m_bar;
int m_baz;
}
@property {
Bar bar() { return m_bar; }
void bar(Bar v) { m_bar = v; }
V Wed, 17 Dec 2014 07:57:24 +
Jack Applegame via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com napsáno:
Code:
import std.stdio;
struct Bar {
int payload;
alias payload this;
}
struct Foo {
private {
Bar m_bar;
int m_baz;
On 17/12/2014 8:57 p.m., Jack Applegame wrote:
Code:
import std.stdio;
struct Bar {
int payload;
alias payload this;
}
struct Foo {
private {
Bar m_bar;
int m_baz;
}
@property {
Bar bar() { return m_bar; }
void bar(Bar v) { m_bar =
I've written a small program that uses UdpSocket (std.socket) to
query a DNS server for selected records.
It works as expected, but I would like to try a non-blocking
approach.
The last time I wrote socket code (without a supporting library)
was over a decade ago, and even then it was not
On 17/12/2014 9:20 p.m., Andre Artus wrote:
I've written a small program that uses UdpSocket (std.socket) to query a
DNS server for selected records.
It works as expected, but I would like to try a non-blocking approach.
The last time I wrote socket code (without a supporting library) was
over
On Wednesday, 17 December 2014 at 08:09:44 UTC, Daniel Kozák via
Digitalmars-d-learn wrote:
This should work only with ref by spec
I totally agree.
V Wed, 17 Dec 2014 08:20:42 +
Andre Artus via Digitalmars-d-learn digitalmars-d-learn@puremagic.com
napsáno:
I've written a small program that uses UdpSocket (std.socket) to
query a DNS server for selected records.
It works as expected, but I would like to try a non-blocking
approach.
-- snip --
Have you looked at vibe.d?
https://github.com/rejectedsoftware/vibe.d/blob/master/examples/udp/source/app.d
Thanks Rikki,
I saw that before, but I was left with the impression that its
doing blocking calls in a thread (which could very well be the
simplest answer). I'll give it
-- snip --
https://github.com/etcimon/libasync
http://code.dlang.org/packages/libevent
http://code.dlang.org/packages/libev
http://code.dlang.org/packages/libuv
Thanks Daniel,
These links look interesting. Perhaps libasync could do the trick.
On Wed, 17 Dec 2014 02:34:15 +
aldanor via Digitalmars-d-learn digitalmars-d-learn@puremagic.com
wrote:
On Wednesday, 17 December 2014 at 02:12:52 UTC, anonymous wrote:
Sure, straight forward:
mixin template makeProperty(T, string name, alias func) {
mixin(T %s()
Hi,
Could someone explain me, if and how it is possible to allocate a
variable length array with inline assembly?
Somewhat like
int[] arr;
int n = 42;
asm {
// allocate n stack space for arr
}
I know it is dangerous and all that, but I just want it know. ;)
Foo:
Hi,
Could someone explain me, if and how it is possible to allocate
a variable length array with inline assembly?
Somewhat like
int[] arr;
int n = 42;
asm {
// allocate n stack space for arr
}
I know it is dangerous and all that, but I just want it know. ;)
Doing it with
On 15.12.14 01:00, Nordlöw wrote:
Isn't this algorithm already encoded somewhere in Phobos?
void append(T, Args...)(ref T[] arr, auto ref Args args){
{
static if (args.length == 1)
arr ~= args[0]; // inlined
else{
arr.length += args.length;
foreach(i, e; args)
On Wednesday, 17 December 2014 at 10:59:09 UTC, bearophile wrote:
Foo:
Hi,
Could someone explain me, if and how it is possible to
allocate a variable length array with inline assembly?
Somewhat like
int[] arr;
int n = 42;
asm {
// allocate n stack space for arr
}
I know it is
On Wednesday, 17 December 2014 at 11:39:43 UTC, Foo wrote:
On Wednesday, 17 December 2014 at 10:59:09 UTC, bearophile
wrote:
Foo:
Hi,
Could someone explain me, if and how it is possible to
allocate a variable length array with inline assembly?
Somewhat like
int[] arr;
int n = 42;
asm {
On Wednesday, 17 December 2014 at 12:15:23 UTC, uri wrote:
On Wednesday, 17 December 2014 at 11:39:43 UTC, Foo wrote:
On Wednesday, 17 December 2014 at 10:59:09 UTC, bearophile
wrote:
Foo:
Hi,
Could someone explain me, if and how it is possible to
allocate a variable length array with
On Wednesday, 17 December 2014 at 11:15:30 UTC, zeljkog wrote:
On 15.12.14 01:00, Nordlöw wrote:
Isn't this algorithm already encoded somewhere in Phobos?
void append(T, Args...)(ref T[] arr, auto ref Args args){
{
static if (args.length == 1)
arr ~= args[0]; // inlined
else{
On Wednesday, 17 December 2014 at 02:34:16 UTC, aldanor wrote:
On Wednesday, 17 December 2014 at 02:12:52 UTC, anonymous wrote:
Sure, straight forward:
mixin template makeProperty(T, string name, alias func) {
mixin(T %s() @property { return func();
}.format(name));
}
On Wednesday, 17 December 2014 at 10:35:39 UTC, Foo wrote:
Hi,
Could someone explain me, if and how it is possible to allocate
a variable length array with inline assembly?
Somewhat like
int[] arr;
int n = 42;
asm {
// allocate n stack space for arr
}
I know it is dangerous and
On Wednesday, 17 December 2014 at 12:54:44 UTC, btdc wrote:
On Wednesday, 17 December 2014 at 10:35:39 UTC, Foo wrote:
Hi,
Could someone explain me, if and how it is possible to
allocate a variable length array with inline assembly?
Somewhat like
int[] arr;
int n = 42;
asm {
//
On Wednesday, 17 December 2014 at 09:37:47 UTC, Andre Artus wrote:
-- snip --
Have you looked at vibe.d?
https://github.com/rejectedsoftware/vibe.d/blob/master/examples/udp/source/app.d
Thanks Rikki,
I saw that before, but I was left with the impression that its
doing blocking calls in a
On 17.12.14 13:30, Tobias Pankrath wrote:
void append(T, Args...)(ref T[] data, Args args)
{
static size_t estimateLength(Args args)
{
size_t result;
foreach(e; args)
static if(hasLength!(typeof(e)))
result += e.length;
else
And it is using malloc... ;)
I wanted something that increases the stack pointer ESP.
e.g.
void main()
{
int[] arr;
int n = 42;
writeln(arr.length);
writeln(arr.ptr);
asm {
mov EAX, n;
mov [arr + 8],
I've been doing some benchmarking the bt function
(http://dlang.org/phobos/core_bitop.html) up against a regular
bit -operator, and I'm a bit confused over the timings.
I'd expect the bt function to be up to 32 times faster as I
thought it only compared two bits, and not the entire length of
On Wednesday, 17 December 2014 at 12:29:53 UTC, Foo wrote:
And how? I'm on Windows.
Digital Mars sells an obj2asm function that will disassemble dmd
generated code. I think it is in the $15 basic utility package.
But VLA/alloca is more complex than a regular function - the
compiler needs
On Wednesday, 17 December 2014 at 14:12:16 UTC, Trollgeir wrote:
I'd expect the bt function to be up to 32 times faster as I
thought it only compared two bits, and not the entire length of
bits in the uint.
The processor doesn't work in terms of bits like that - it still
needs to look at the
We write new signal/slot system? like in QT.
https://github.com/dexset/descore/tree/de9ccae7a9907e5098f244a8683e42fb660d0b35/import/des/util/signal
https://github.com/dexset/descore/tree/de9ccae7a9907e5098f244a8683e42fb660d0b35/import/des/util/object
Unittests works fine, but after trying using
On Wednesday, 17 December 2014 at 14:11:32 UTC, Foo wrote:
And it is using malloc... ;)
I wanted something that increases the stack pointer ESP.
e.g.
void main()
{
int[] arr;
int n = 42;
writeln(arr.length);
writeln(arr.ptr);
asm {
On 12/17/2014 03:01 AM, Kagamin wrote:
previous thread:
http://forum.dlang.org/post/mailman.1464.1415039051.9932.digitalmar...@puremagic.com
I read that thread. I don't understand if / how it answers this question.
--
Paul O'Neil
Github / IRC: todayman
On Wednesday, 17 December 2014 at 12:49:10 UTC, anonymous wrote:
As far as I understand, the string mixin is resolved first, and
then the template mixin takes place. So the progression is
somewhat like this (pseudo code):
mixin makeProperty!(int, foo, f);
/* Replace makeProperty with its
On Wed, Dec 17, 2014 at 03:13:27PM +, Akzwar via Digitalmars-d-learn wrote:
[...]
Finally compilation crashes with exit code -6:
dmd: class.c:859: virtual void ClassDeclaration::semantic(Scope*): Assertion
`type-ty != Tclass || ((TypeClass *)type)-sym == this' failed.
[...]
This is an ICE
On Wednesday, 17 December 2014 at 14:58:13 UTC, Adam D. Ruppe
wrote:
On Wednesday, 17 December 2014 at 14:12:16 UTC, Trollgeir wrote:
I'd expect the bt function to be up to 32 times faster as I
thought it only compared two bits, and not the entire length
of bits in the uint.
The processor
On Wednesday, 17 December 2014 at 14:11:32 UTC, Foo wrote:
asm {
mov EAX, n;
mov [arr + 8], ESP;
sub [ESP], EAX;
mov [arr + 0], EAX;
}
but that does not work...
That wouldn't work even with malloc remember, an
On Wednesday, 17 December 2014 at 15:20:28 UTC, btdc wrote:
On Wednesday, 17 December 2014 at 14:11:32 UTC, Foo wrote:
And it is using malloc... ;)
I wanted something that increases the stack pointer ESP.
e.g.
void main()
{
int[] arr;
int n = 42;
On Wed, Dec 17, 2014 at 04:08:40PM +, Trollgeir via Digitalmars-d-learn
wrote:
On Wednesday, 17 December 2014 at 14:58:13 UTC, Adam D. Ruppe wrote:
On Wednesday, 17 December 2014 at 14:12:16 UTC, Trollgeir wrote:
I'd expect the bt function to be up to 32 times faster as I thought
it only
On Wednesday, 17 December 2014 at 16:10:40 UTC, Adam D. Ruppe
wrote:
On Wednesday, 17 December 2014 at 14:11:32 UTC, Foo wrote:
asm {
mov EAX, n;
mov [arr + 8], ESP;
sub [ESP], EAX;
mov [arr + 0], EAX;
}
but that
On Wednesday, 17 December 2014 at 15:40:25 UTC, aldanor wrote:
On Wednesday, 17 December 2014 at 12:49:10 UTC, anonymous wrote:
[...]
As to if there were `T` or `func` in the target scope, they'd
be
shadowed by the template parameters, no matter if there's a
string mixin or not.
That makes
Is this behavior normal or it's bug?
[code]
import std.stdio;
class A
{
float func( float x )
in
{
assert( x 0 );
stderr.writeln( A.func in block );
}
body
{
stderr.writeln( A.func body block );
return x / 3;
}
}
class B : A
{
On Wednesday, 17 December 2014 at 21:07:12 UTC, Oleg wrote:
Is this behavior normal or it's bug?
[code]
import std.stdio;
class A
{
float func( float x )
in
{
assert( x 0 );
stderr.writeln( A.func in block );
}
body
{
stderr.writeln( A.func
On Wednesday, 17 December 2014 at 21:17:57 UTC, John Colvin wrote:
On Wednesday, 17 December 2014 at 21:07:12 UTC, Oleg wrote:
Is this behavior normal or it's bug?
[code]
import std.stdio;
class A
{
float func( float x )
in
{
assert( x 0 );
stderr.writeln( A.func in
I'm trying (hard) to learn D templating, and (thanks to the great
help on this forum) I've been able to solve one of the recent
tasks I've been struggling about for a while. Wonder if anyone
would take a moment to criticize the code so we rookies could
learn?
Could this be done more
I've no idea why the forum decided to wrap all code; anyway:
https://gist.github.com/aldanor/ddc45b2710a2deb9ee2b
On 12/07/2014 03:12 PM, Michael wrote:
now to figure out how to use them in the general case.
This is great.. Thank you. I'm looking forward to being able to try the
finished result.
My build servers are broken at the moment, but I think I have this
fixed, on linux at least.
void main () {
struct X {
string x;
void opCall (string y) {
import std.stdio;
writeln(%s %s!, x, y);
}
}
auto x = X(hello);
world.x;
}
source/main.d(12): Error: need 'this' for 'opCall' of type
'void(string y)'
On Thursday, 18 December 2014 at 02:42:32 UTC, Jay Pinkman wrote:
source/main.d(12): Error: need 'this' for 'opCall' of type
'void(string y)'
D doesn't have a really clean separation between static and
non-static methods. It sees an opCall and thinks you're trying to
call it, but since it
On Thursday, 18 December 2014 at 02:45:01 UTC, Adam D. Ruppe
wrote:
D doesn't have a really clean separation between static and
non-static methods.
hmm.. i thought that's what 'static' is for.
It sees an opCall and thinks you're trying to call it, but
since it isn't static, it complains you
I've installed SDL2.
Joels-MacBook-Pro:DerelictTest joelcnz$ cat test.d
import derelict.sdl2.sdl;
int main() {
DerelictSDL2.load();
}
Joels-MacBook-Pro:DerelictTest joelcnz$ dmd test
libDerelictSDL2.a libDerelictUtil.a
Joels-MacBook-Pro:DerelictTest joelcnz$ ./test
On Thursday, 18 December 2014 at 06:29:34 UTC, Joel wrote:
I've installed SDL2.
Joels-MacBook-Pro:DerelictTest joelcnz$ cat test.d
import derelict.sdl2.sdl;
int main() {
DerelictSDL2.load();
}
Joels-MacBook-Pro:DerelictTest joelcnz$ dmd test
libDerelictSDL2.a libDerelictUtil.a
Did you check if you installed SDL already on your machine?
I followed the SDL2 instructions (on the SDL web site) for OS X
before using Derelict. It had about copying to a curtain folder,
which I did.
On Thursday, 18 December 2014 at 07:10:43 UTC, Joel wrote:
Did you check if you installed SDL already on your machine?
I followed the SDL2 instructions (on the SDL web site) for OS X
before using Derelict. It had about copying to a curtain
folder, which I did.
Just noticed that you used
50 matches
Mail list logo