On Saturday, 14 December 2013 at 00:15:30 UTC, Marco Leise wrote:
Am Fri, 13 Dec 2013 21:40:10 +0100
schrieb "Benji" :
I got two errors mentioned above at once.. :(
What the heck is happening on your system? :(
I plan to install Arch, so hope that will solve it :P
Thanks!
-
receive(
(shared(Socket) c) {
Socket cli = cast(Socket) c;
while (cli.isAlive()) {
ubyte[8192] buf;
ulong bufLen = cli.receive(buf);
...
}
}
);
On Saturday, 14 December 2013 at 00:53:27 UTC, Andrea Fontana
wrote:
Consider this way to escape current constness:
This isn't "escaping" constness. Const only means mutation is
prevented through that particular reference. It is distinct from
immutability.
On Saturday, 14 December 2013 at 00:31:24 UTC, Adam D. Ruppe
wrote:
On Saturday, 14 December 2013 at 00:24:01 UTC, Andrea Fontana
wrote:
Just another thought. If we have:
class B;
struct C;
class A
{
void method() const { ... }
B another_class;
C a_struct;
}
B is just a reference to a o
On 12/13/2013 04:11 PM, Irving Montalvo wrote:
How do I pass a socket to concurrency?
send(tid, cli); // Socket cli
--
receive (
(Socket cli) {
cli.send("1234567890");
}
)
-
Help me :)
Unfortunately, some cast(shared) is needed at this time:
import std.stdio;
import
On Friday, 13 December 2013 at 23:46:14 UTC, Andrea Fontana wrote:
class A
{
auto getter() const
{
return property;
}
int property = 0;
}
Please notice that getter method is marked as const. Why this
method return "const int"?
`const` as a function attribute just mar
On Saturday, 14 December 2013 at 00:24:01 UTC, Andrea Fontana
wrote:
Just another thought. If we have:
class B;
struct C;
class A
{
void method() const { ... }
B another_class;
C a_struct;
}
B is just a reference to a object, so method() should not
reassign it. The reference should b
On Saturday, 14 December 2013 at 00:09:03 UTC, Andrea Fontana
wrote:
I'm not changing anything. Just returning it.
Right, it is just that "auto" keeps the exact type, and in the
const method, the exact type of the members are all const too
since that's how the language enforces that you don't
Just another thought. If we have:
class B;
struct C;
class A
{
void method() const { ... }
B another_class;
C a_struct;
}
B is just a reference to a object, so method() should not
reassign it. The reference should be const, not the object
itself. method() should be able to call mutab
Am Fri, 13 Dec 2013 21:40:10 +0100
schrieb "Benji" :
> I got two errors mentioned above at once.. :(
What the heck is happening on your system? :(
--
Marco
How do I pass a socket to concurrency?
send(tid, cli); // Socket cli
--
receive (
(Socket cli) {
cli.send("1234567890");
}
)
-
Help me :)
Am Fri, 13 Dec 2013 21:02:58 +0100
schrieb "FreeSlave" :
> Thanks for answers.
>
> On Friday, 13 December 2013 at 19:35:01 UTC, Marco Leise wrote:
> > Have you tried this?:
> >
> > import core.memory;
> > int[] data = (cast(int*)GC.malloc(size * int.sizeof,
> > GC.BlkAttr.NO_SCAN))[0 .. size];
>
I read:
Const Member Functions
Const member functions are functions that are not allowed to
change any part of the object through the member function's this
reference.
I'm not changing anything. Just returning it.
Is this a try to avoid something like the following, then?
... B getter() con
On Friday, 13 December 2013 at 23:46:14 UTC, Andrea Fontana wrote:
class A
{
auto getter() const
{
return property;
}
int property = 0;
Why this method return "const int"?
Inside getter, "this" is const. Due to transitive const, all the
members through this are const
On 12/13/2013 03:53 PM, Irving Montalvo wrote:
Socket[ulong] clients;
---main()
ulong index = clients.length;
clients[index] = cli; //<-- Socket cli
send(tid, index)
-spawned()
receive(
(ulong i) {
clients[i].send('Hello concur
Socket[ulong] clients;
---main()
ulong index = clients.length;
clients[index] = cli; //<-- Socket cli
send(tid, index)
-spawned()
receive(
(ulong i) {
clients[i].send('Hello concurrent'); // Error clients.length is
zero
}
);
--
class A
{
auto getter() const
{
return property;
}
int property = 0;
}
Please notice that getter method is marked as const. Why this
method return "const int"?
If i force it declaring:
int getter() const
it returns "int". It takes me a lot to understand where the is
On Friday, 13 December 2013 at 19:22:20 UTC, Marco Leise wrote:
Am Fri, 13 Dec 2013 19:48:46 +0100
schrieb "Benji" :
When I compile it this way: dmd helloa.d -L-lphobos2 -L-lcurl
Another error appear:
[...]
helloa.d:(.text._D3std6format66__T14formattedWriteTS3std5array17__T8AppenderTAyaZ8Appen
Thanks for answers.
On Friday, 13 December 2013 at 19:35:01 UTC, Marco Leise wrote:
Have you tried this?:
import core.memory;
int[] data = (cast(int*)GC.malloc(size * int.sizeof,
GC.BlkAttr.NO_SCAN))[0 .. size];
Did you mean GC.BlkAttr.NONE maybe? If I get it right
GC.BlkAttr.NO_SCAN means
On Friday, 13 December 2013 at 12:10:02 UTC, comco wrote:
Imagine a world in which a simple 'if' has the semantics of a
static if, if the condition is evaluable at CT. Is this a world
you would rather live in?
They are fundamentally two different things. Eliding the
difference is not a good i
Am Fri, 13 Dec 2013 19:47:34 +0100
schrieb "FreeSlave" :
> Suppose some class contains slice (dynamic array) as data member.
> Constructor takes integer value that defines the size of data
> should be allocated. After object was constructed size of slice
> never changes by design.
>
> Dynamic
Am Fri, 13 Dec 2013 19:48:46 +0100
schrieb "Benji" :
> When I compile it this way: dmd helloa.d -L-lphobos2 -L-lcurl
> Another error appear:
>
> [...]
> helloa.d:(.text._D3std6format66__T14formattedWriteTS3std5array17__T8AppenderTAyaZ8AppenderTaTmTmZ14formattedWriteFNaNfS3std5array17__T8AppenderT
On 12/13/2013 10:47 AM, FreeSlave wrote:
> Suppose some class contains slice (dynamic array) as data member.
> Constructor takes integer value that defines the size of data should be
> allocated. After object was constructed size of slice never changes by
> design.
>
> Dynamic arrays are allocate
On Friday, 13 December 2013 at 15:00:57 UTC, Marco Leise wrote:
Am Thu, 12 Dec 2013 20:29:31 +0100
schrieb "Benji" :
On Thursday, 12 December 2013 at 19:11:03 UTC, John Colvin
wrote:
> On Thursday, 12 December 2013 at 16:44:28 UTC, Benji wrote:
>> Hello,
>> when I try to compile something with
Suppose some class contains slice (dynamic array) as data member.
Constructor takes integer value that defines the size of data
should be allocated. After object was constructed size of slice
never changes by design.
Dynamic arrays are allocated with extra space that we can know
from 'capacit
On Friday, 13 December 2013 at 18:03:28 UTC, Nikolay wrote:
Results:
~/ldc2-0.12.0-linux-x86_64/bin/ldmd2 -O -release -inline
zip_test.d
./zip_test --limit 1000
…
0 - 0
1 - 764
And now try -inline-threshold=1024 ;-)
Reading -help-hidden sometimes helps.
It works fine when using dup to the value returned by nativeToBigEndian:
public void opAssign(uint value)
{
this._octets = value.nativeToBigEndian().dup;
assert(this._octets == cast (ubyte[]) [1, 2, 3, 4]);
}
On 12/13/2013 06:35 PM, John Colvin wrote:
On Friday, 13
I found that performance of ranges is miserable in many cases.
You should not use them if there is any chance for big/critical
computations. Actually I don't like to have two subsets of
language: one with good performance, and other with good
maintainability/readability. I have a couple thought
On Friday, 13 December 2013 at 16:37:51 UTC, Gary Willoughby
wrote:
I have the following code which is massively simplified from a
larger type. The problem occurs between assigning the value to
the type and retrieving it.
The value is assigned through opAssign and the assert passes.
When usin
I have the following code which is massively simplified from a
larger type. The problem occurs between assigning the value to
the type and retrieving it.
The value is assigned through opAssign and the assert passes.
When using a property to retrieve the same data the assert fails!
import std
On Friday, 13 December 2013 at 15:54:06 UTC, Marco Leise wrote:
Am Fri, 13 Dec 2013 16:08:22 +0100
schrieb "John Colvin" :
On Friday, 13 December 2013 at 15:00:57 UTC, Marco Leise wrote:
> I'd say format c:
A bit drastic, or am i missing something?!?!
That was meant as "remove anything D rel
On Fri, Dec 13, 2013 at 10:46:57AM +0100, John Colvin wrote:
> On Friday, 13 December 2013 at 01:51:25 UTC, Ithy wrote:
> >Hello. I'm just getting into D (literally writing my first
> >program), and I can't figure out how to do this with getopt:
> >
> >I want to have the option --log, which will en
On Fri, Dec 13, 2013 at 04:20:18PM +0100, Joseph Rushton Wakeling wrote:
> On 13/12/13 16:52, Marco Leise wrote:
> >Most non-trivial ranges do the actual work in `popFront()' and
> >return a cached value from `front'. It has been argued as a
> >design quirk, that this in general leads to:
> >
> >st
Am Fri, 13 Dec 2013 16:08:22 +0100
schrieb "John Colvin" :
> On Friday, 13 December 2013 at 15:00:57 UTC, Marco Leise wrote:
> > I'd say format c:
>
> A bit drastic, or am i missing something?!?!
That was meant as "remove anything D related from your
system". format c: on a POSIX system, come on
I've just discovered the fantastic tool perf on Linux.
I profiled a D program with this but when I call
perf report
the symbols are not demangled.
I'm aware of `ddemangle` but this only works in batch-processing
mode. I could always dump the output to a file for viewing. But
it would be
On Friday, 13 December 2013 at 12:10:02 UTC, comco wrote:
Imagine a world in which a simple 'if' has the semantics of a
static if, if the condition is evaluable at CT. Is this a world
you would rather live in?
template Fac(int i) {
if (i == 0) { // static if; doesn't introduce scope
enum Fac =
On 13/12/13 16:52, Marco Leise wrote:
Most non-trivial ranges do the actual work in `popFront()' and
return a cached value from `front'. It has been argued as a
design quirk, that this in general leads to:
struct Range
{
bool popFrontHasBeenCalledOnce = false;
T current;
@property T fr
Am Thu, 12 Dec 2013 16:02:28 +0100
schrieb "John Colvin" :
> On Wednesday, 11 December 2013 at 16:40:48 UTC, Joseph Rushton
> Wakeling wrote:
> > [* If I recall right, it's achievable by special-casing iota
> > when the increment is 1, but don't quote me on that.]
>
> That shouldn't be necessar
On Friday, 13 December 2013 at 15:00:57 UTC, Marco Leise wrote:
I'd say format c:
A bit drastic, or am i missing something?!?!
Am Thu, 12 Dec 2013 20:29:31 +0100
schrieb "Benji" :
> On Thursday, 12 December 2013 at 19:11:03 UTC, John Colvin wrote:
> > On Thursday, 12 December 2013 at 16:44:28 UTC, Benji wrote:
> >> Hello,
> >> when I try to compile something with dmd,
> >> I get following message:
> >>
> >> /usr/include/d
Am Thu, 12 Dec 2013 08:43:35 -0800
schrieb "H. S. Teoh" :
> I do this with my own ranges sometimes. Sometimes, it's more performant
> to precompute the value of .front and store it (as .front), and have
> .popFront compute the next value, than to have .front compute the value
> every time. AFAICT,
Am Thu, 12 Dec 2013 18:08:12 +0100
schrieb "Jacek Furmankiewicz" :
> void rename(in char[] from, in char[] to);
> Rename file from to to. If the target file exists, it is
> overwritten.
>
> Throws:
> FileException on error.
>
> Just wanted to know if this operatio
On Friday, 13 December 2013 at 05:55:09 UTC, H. S. Teoh wrote:
On Fri, Dec 13, 2013 at 06:42:26AM +0100, Brian Rogoff wrote:
I'm sympathetic to this POV, or something similar. For
example, a
multiyear plan to deprecate the 'is' syntax and replace it with
something better, in the current D. I'm
On Friday, 13 December 2013 at 13:23:24 UTC, Mike James wrote:
On Friday, 13 December 2013 at 12:09:59 UTC, John Colvin wrote:
On Friday, 13 December 2013 at 11:40:35 UTC, Mike James wrote:
Hi,
Is it possible to pass a string array to a string mixin e.g
template GenSomething(string foo, strin
On Friday, 13 December 2013 at 12:09:59 UTC, John Colvin wrote:
On Friday, 13 December 2013 at 11:40:35 UTC, Mike James wrote:
Hi,
Is it possible to pass a string array to a string mixin e.g
template GenSomething(string foo, string[] bar){
some_kind_of_foreach(br: bar) {
const char[] foo ~
On Friday, 13 December 2013 at 12:50:01 UTC, Nicolas Sicard wrote:
On Friday, 13 December 2013 at 12:10:02 UTC, comco wrote:
Imagine a world in which a simple 'if' has the semantics of a
static if, if the condition is evaluable at CT. Is this a
world you would rather live in?
template Fac(int
On Friday, 13 December 2013 at 12:10:02 UTC, comco wrote:
Imagine a world in which a simple 'if' has the semantics of a
static if, if the condition is evaluable at CT. Is this a world
you would rather live in?
template Fac(int i) {
if (i == 0) { // static if; doesn't introduce scope
enum Fac =
On Friday, 13 December 2013 at 11:40:35 UTC, Mike James wrote:
Hi,
Is it possible to pass a string array to a string mixin e.g
template GenSomething(string foo, string[] bar){
some_kind_of_foreach(br: bar) {
const char[] foo ~ br ~ ";\n";
}
}
and call:
mixin(GenSomething!("A", ["B", "
Imagine a world in which a simple 'if' has the semantics of a
static if, if the condition is evaluable at CT. Is this a world
you would rather live in?
template Fac(int i) {
if (i == 0) { // static if; doesn't introduce scope
enum Fac = 1;
} else {
enum Fac = i * Fac!(i-1);
}
}
// If the condi
From client perspective, properties look like member variables.
With (auto) ref, a generic function can catch a member variable
and read it and update it:
void swap(T)(ref T a, ref T b) {...}
The client can use swap with member variables.
But he can't use this swap with class properties - they
On Friday, 13 December 2013 at 00:37:36 UTC, Namespace wrote:
Why don't you discuss on github?
And finally I did it:
auto[$] a_arr2 = dyn_arr[4 .. 8];
assert(is(typeof(a_arr2) == int[4]));
I will make a Pull Request tomorrow. Hope my code isn't that
bad. :/
Done:
https://github.co
Hi,
Is it possible to pass a string array to a string mixin e.g
template GenSomething(string foo, string[] bar){
some_kind_of_foreach(br: bar) {
const char[] foo ~ br ~ ";\n";
}
}
and call:
mixin(GenSomething!("A", ["B", "C", "D"]));
would generate:
A.B;
A.C;
A.D;
Regards,
-=mike=-
On 12/13/2013 5:00 PM, Dfr wrote:
Hello
I trying to write simple wrapper around pcre and have problem passing
strings to it. As i understood, the best way is std.string.toStringZ.
So, my code look like:
string pattern = "";
pcre_compile2( toStringz(pattern), options, &errcode, &errmsg,
&er
On Friday, 13 December 2013 at 01:51:25 UTC, Ithy wrote:
Hello. I'm just getting into D (literally writing my first
program), and I can't figure out how to do this with getopt:
I want to have the option --log, which will enable logging (set
a bool variable to true). However, I want the program
On Friday, December 13, 2013 09:00:20 Dfr wrote:
> Hello
>
> I trying to write simple wrapper around pcre and have problem
> passing strings to it. As i understood, the best way is
> std.string.toStringZ.
>
> So, my code look like:
>
> string pattern = "";
> pcre_compile2( toStringz(pattern)
On Friday, 13 December 2013 at 01:20:41 UTC, Mike Parker wrote:
On 12/13/2013 7:52 AM, Gary Willoughby wrote:
I have a lot of opaque types in C headers i'm porting to D.
What is the
best way to handle these? Would you just use void pointers?
In the below example Tcl_AsyncHandler_ is not define
On Friday, 13 December 2013 at 08:00:21 UTC, Dfr wrote:
Hello
I trying to write simple wrapper around pcre and have problem
passing strings to it. As i understood, the best way is
std.string.toStringZ.
So, my code look like:
string pattern = "";
pcre_compile2( toStringz(pattern), optio
Hello
I trying to write simple wrapper around pcre and have problem
passing strings to it. As i understood, the best way is
std.string.toStringZ.
So, my code look like:
string pattern = "";
pcre_compile2( toStringz(pattern), options, &errcode, &errmsg,
&erroffset, cast(char*)null);
T
58 matches
Mail list logo