On Monday, 9 February 2015 at 05:50:00 UTC, uri wrote:
On Saturday, 7 February 2015 at 23:29:01 UTC, Namespace wrote:
On Saturday, 7 February 2015 at 22:09:03 UTC, Gan wrote:
Is there a better D graphics library in the works?
I'm using SFML(which is very easy and has lots of features)
but it
On Monday, 9 February 2015 at 07:32:33 UTC, rumbu wrote:
class Outer
{
class Inner
{
static Inner createInner()
{
return new Inner(); //need 'this' to access member
this
}
}
}
Is this a bug?
If Inner is not nested, it works as expected:
class
On Mon, 09 Feb 2015 07:32:32 +, rumbu wrote:
class Outer {
class Inner {
static Inner createInner()
{
return new Inner(); //need 'this' to access member
this
}
}
}
Is this a bug?
strictly speaking, this is not a bug. compiler
On Sunday, 8 February 2015 at 19:57:28 UTC, Jonathan M Davis
wrote:
On Sunday, February 08, 2015 17:51:09 bearophile via
Digitalmars-d-learn wrote:
fra:
However making it a compiler error would be far, far better
I think this can be filed in Bugzilla as diagnostic
enhancement:
class Foo
On Sunday, 8 February 2015 at 22:19:35 UTC, ChrisG wrote:
Thanks bearophile. Your first suggestion about making the
struct a template is something I considered. However, because
of all the code I've already written that approach would force
me to use inheritance or convert a ton of functions
I am using programming in D to learn about D language. I wrote
a simple program that spawns a worker and sends it a number to
receive its square as a string. The worker 1 gets the number
squares it and sends to worker 2 (a different function) to get
casted as string which is returned to the
https://github.com/Hackerpilot/libdparse/blob/master/src/std/d/lexer.d#L1491
Of course consuming it dchar by dchar also works:
string s = `\tabŁŃ\r\nx`;
assert(parseDchar(s) == '\t');
assert(parseDchar(s) == 'a');
assert(parseDchar(s) == 'b');
assert(parseDchar(s) == 'Ł');
assert(parseDchar(s) == 'Ń');
assert(parseDchar(s) == '\r');
On 2015-02-09 at 03:40, Timothee Cour via Digitalmars-d-learn wrote:
Is there a simple way to parse a string as a char?
eg:
unittest{
assert(parseChar(`a`)=='a');
assert(parseChar(`\n`)=='\n'); //NOTE: I'm looking at `\n` not \n
// should also work with other forms of characters, see
On 2015-02-10 at 01:41, bearophile wrote:
auto query = iota(2, 12)
.map!(c = Tuple!(int,length, int,height,
int,hypotenuse)
(2 * c, c ^^ 2 - 1, c ^^ 2 + 1))
.map!(x = %3d%4d%4d.format(x.height, x.hypotenuse,
On Tuesday, 10 February 2015 at 01:31:54 UTC, FG wrote:
On 2015-02-10 at 01:41, bearophile wrote:
auto query = iota(2, 12)
.map!(c = Tuple!(int,length, int,height,
int,hypotenuse)
(2 * c, c ^^ 2 - 1, c ^^ 2 +
1))
.map!(x
On 02/09/2015 08:17 PM, Dennis Ritchie wrote:
Ali, and you can write it without using the function iota() and map?
No because the a..b syntax is not a D language construct that we can use
anywhere that it makes sense. It only works as number ranges inside
foreach loops, when indexing slices,
On Tuesday, 10 February 2015 at 03:59:22 UTC, Rikki Cattermole
wrote:
That's a bug. It should be using the function pointer.
UFCS call should abide by the same scoping rules as anything
else.
https://issues.dlang.org/show_bug.cgi?id=14161
I thought that's how UFCS was explicitly designed?
On Monday, 9 February 2015 at 20:16:45 UTC, Ali Çehreli wrote:
Yes, but apparently D's default precision for output is less
than F#'s so how about the following? :p
%(%.15g\n%).writefln(iota(0, PI/2, PI/2/9).map!sin);
Just for demonstration, I would not write anything like that
but the
Hi!
I think this code should not be compiled without any warning:
import std.stdio;
void f(int a) {
writeln(it's a function! : , a);
}
void main() {
auto f = function (int a) {writeln(It's a variable! : ,
a);};
5.f();
f(5);
}
Output:
it's a function! : 5
It's a variable! :
On Tuesday, 10 February 2015 at 03:59:22 UTC, Rikki Cattermole
wrote:
That's a bug. It should be using the function pointer.
UFCS call should abide by the same scoping rules as anything
else.
https://issues.dlang.org/show_bug.cgi?id=14161
Moreover. If the function is not defined (only
On Tuesday, 10 February 2015 at 05:09:00 UTC, Jakob Ovrum wrote:
On Tuesday, 10 February 2015 at 04:44:55 UTC, weaselcat wrote:
Thread title.
interface Itest{
}
class testclass : Itest{
}
void main()
{
import std.typecons;
auto test = RefCounted!Itest(new testclass());
}
If you
On Tuesday, 10 February 2015 at 06:17:17 UTC, Ali Çehreli wrote:
On 02/09/2015 08:17 PM, Dennis Ritchie wrote:
Ali, and you can write it without using the function iota()
and map?
No because the a..b syntax is not a D language construct that
we can use anywhere that it makes sense. It only
On 2/8/15 2:57 PM, Jonathan M Davis via Digitalmars-d-learn wrote:
On Sunday, February 08, 2015 17:51:09 bearophile via Digitalmars-d-learn wrote:
fra:
However making it a compiler error would be far, far better
I think this can be filed in Bugzilla as diagnostic enhancement:
class Foo {
On 2/9/15 4:30 AM, ketmar wrote:
On Mon, 09 Feb 2015 07:32:32 +, rumbu wrote:
class Outer {
class Inner {
static Inner createInner()
{
return new Inner(); //need 'this' to access member
this
}
}
}
Is this a bug?
strictly speaking,
On Monday, 9 February 2015 at 20:03:00 UTC, Vladimir Panteleev
wrote:
On Monday, 9 February 2015 at 19:57:23 UTC, Ali Çehreli wrote:
writefln(%(%.15g\n%), sins);
In 2.067, you can write:
iota(0, PI/2, PI/2/9).map!sin.each!writeln;
March 1!
On 02/09/2015 11:46 AM, Ali Çehreli wrote:
threads normally start one [or] more worker threads and
send tasks to those threads
Accordingly, the following program uses just three threads:
import std.stdio;
import std.concurrency;
import std.conv;
import core.thread;
struct Terminate
{}
void
When binding C++ value types you might want to use them by placing them
on the D-Stack. This however seems to be not supported as the mangling
for the constructor is completely wrong. Is this supposed to work?
Kind Regards
Benjamin Thaut
On Monday, 9 February 2015 at 19:40:42 UTC, Dennis Ritchie wrote:
Good evening.
Is it possible to D something to replace the container on the
F#, which displays the values of the sine from 0 to 90 degrees
with an interval of 10 degrees:
let pi = Math.PI
let sins = [for x in 0.0..pi / 2.0 /
On 02/09/2015 11:45 AM, Tobias Pankrath wrote:
iota(0, 91, 10).map!sin.writeln
or something like that.
Yes: :)
import std.math;
import std.stdio;
import std.range;
import std.algorithm;
void main()
{
const beg = 0.0L;
const interval = PI_2 / 9;
const end = PI_2 + interval;
On Monday, February 09, 2015 13:29:22 Steven Schveighoffer via
Digitalmars-d-learn wrote:
On 2/8/15 2:57 PM, Jonathan M Davis via Digitalmars-d-learn wrote:
On Sunday, February 08, 2015 17:51:09 bearophile via Digitalmars-d-learn
wrote:
fra:
However making it a compiler error would be
Dennis Ritchie:
Tell me, please, how to write similar С# code D:
This is more or less exactly the same:
void main() {
import std.stdio, std.range, std.algorithm, std.typecons,
std.format;
auto query = iota(2, 12)
.map!(c = Tuple!(int,length, int,height,
On 02/09/2015 12:05 PM, Dennis Ritchie wrote:
On Monday, 9 February 2015 at 20:03:00 UTC, Vladimir Panteleev wrote:
On Monday, 9 February 2015 at 19:57:23 UTC, Ali Çehreli wrote:
writefln(%(%.15g\n%), sins);
In 2.067, you can write:
iota(0, PI/2, PI/2/9).map!sin.each!writeln;
March 1!
On 2/9/15 3:15 PM, Jonathan M Davis via Digitalmars-d-learn wrote:
On Monday, February 09, 2015 13:29:22 Steven Schveighoffer via
Digitalmars-d-learn wrote:
On 2/8/15 2:57 PM, Jonathan M Davis via Digitalmars-d-learn wrote:
On Sunday, February 08, 2015 17:51:09 bearophile via
On Monday, 9 February 2015 at 20:11:09 UTC, Ali Çehreli wrote:
On 02/09/2015 11:46 AM, Ali Çehreli wrote:
threads normally start one [or] more worker threads and
send tasks to those threads
Accordingly, the following program uses just three threads:
import std.stdio;
import std.concurrency;
Is there any drawback of doing this: string[Tuple!(int, int)] a;
Especially performance one.
Thanks.
On Monday, 9 February 2015 at 09:30:55 UTC, ketmar wrote:
... you can use `static class Inner` to tell the compiler
that
`Inner` doesn't require any context.
Thank you, static qualifier works. I thought in C# terms where a
static class means anything else.
What I don't quite grab is the construct (in Element e) ,
especially the *in* part.
Function parameters in D can be qualified as in or out,
optionally:
But of course. Actually I kinda found out just a little while
after posting the question. Asking questions is a great way to
figure out
my dom.d works in a familiar way
OK, will check it
useful for scraping html sites.
Not exactly what I'm doing, but close. I'm in the midst of a
self-training spree, and what I use as test-tubes fodder is the
following : a collection of 300+ html files constituting an
electronic version of
On Saturday, 7 February 2015 at 22:09:03 UTC, Gan wrote:
Is there a better D graphics library in the works?
I'm using SFML(which is very easy and has lots of features) but
it seems to use a lot of ram(if you leave it running for a
while on a graphic intensive scene) and trying to make it
On 02/09/2015 12:34 PM, xtreak wrote:
I want the stringConverter to send a message to square which in
turn messages the main function with string hello.
Your code did almost that but there was a bug (which I've pointed out).
So are you saying that message is not delivered to square from
Good evening.
Is it possible to D something to replace the container on the F#,
which displays the values of the sine from 0 to 90 degrees with
an interval of 10 degrees:
let pi = Math.PI
let sins = [for x in 0.0..pi / 2.0 / 9.0..pi / 2.0 - sin x]
sins.Dump()
Output:
0
0,17364817766693
Thank you, Tobias Pankrath and Ali Çehreli.
On Saturday, 7 February 2015 at 18:30:00 UTC, Danny wrote:
[snip]
Seems to work fine so far. Not sure whether it's safe to
raise() inside a signal handler. Calling raise() without
reinstalling the old signal handler is a very bad idea, I
[snip]
I'm not sure that it's really safe to
On Monday, 9 February 2015 at 19:57:23 UTC, Ali Çehreli wrote:
writefln(%(%.15g\n%), sins);
In 2.067, you can write:
iota(0, PI/2, PI/2/9).map!sin.each!writeln;
Tell me, please, how to write similar С# code D:
using System;
using System.Linq;
public class Test
{
public static void Main()
{
var query = Enumerable.Range(2, 10)
.Select(c = new { Length = 2 * c, Height = c * c - 1,
Hypotenuse = c * c + 1 })
.Select(x =
On 02/08/2015 05:21 AM, Danny wrote:
The obvious
bool opEquals(immutable(C) b) immutable {
return value == b.value;
}
doesn't work. Probably have to override the one from Object ? Even
though I don't really use polymorphism here.
override bool opEquals(Object b)
Hmmm...
Just found
https://www.securecoding.cert.org/confluence/display/seccode/void+SIG33-C.+Do+not+recursively+invoke+the+raise%28%29+function,
the bottom part Compliant Solution (POSIX) does raise() in the
signal handler.
However, I can't find it in the POSIX standard at
On 10/02/2015 4:28 p.m., Fyodor Ustinov wrote:
Hi!
I think this code should not be compiled without any warning:
import std.stdio;
void f(int a) {
writeln(it's a function! : , a);
}
void main() {
auto f = function (int a) {writeln(It's a variable! : , a);};
5.f();
f(5);
}
On 02/09/2015 08:00 AM, xtreak wrote:
I am using programming in D to learn about D language. I wrote a
simple program that spawns a worker and sends it a number to receive its
square as a string. The worker 1 gets the number squares it and sends to
worker 2 (a different function) to get casted
On Tuesday, 10 February 2015 at 04:11:43 UTC, Vlad Levenfeld
wrote:
On Tuesday, 10 February 2015 at 03:59:22 UTC, Rikki Cattermole
wrote:
That's a bug. It should be using the function pointer.
UFCS call should abide by the same scoping rules as anything
else.
On Tuesday, 10 February 2015 at 04:20:27 UTC, Fyodor Ustinov
wrote:
IMHO even if it is not a bug, it is a feature - it should not
be compiled without notice.
WBR,
Fyodor.
Agreed, should be a warning at least.
Thread title.
interface Itest{
}
class testclass : Itest{
}
void main()
{
import std.typecons;
auto test = RefCounted!Itest(new testclass());
}
If you change the refcounted to type testclass it doesn't compile
because refcounted doesn't support classes.
Is this a bug, or
On Monday, 9 February 2015 at 19:30:32 UTC, Benjamin Thaut wrote:
When binding C++ value types you might want to use them by
placing them on the D-Stack. This however seems to be not
supported as the mangling for the constructor is completely
wrong. Is this supposed to work?
Kind Regards
On Monday, 9 February 2015 at 21:22:29 UTC, Ondra wrote:
Is there any drawback of doing this: string[Tuple!(int, int)] a;
Especially performance one.
Thanks.
Tuples are really just structs generated on the fly, so they
are very fast. Hashmaps use the GC, though, so keep that in mind.
On Tuesday, 10 February 2015 at 04:44:55 UTC, weaselcat wrote:
Thread title.
interface Itest{
}
class testclass : Itest{
}
void main()
{
import std.typecons;
auto test = RefCounted!Itest(new testclass());
}
If you change the refcounted to type testclass it doesn't
compile because
51 matches
Mail list logo