On Saturday, 7 December 2013 at 23:11:39 UTC, Rémy Mouëza wrote:
My strategy here would be to:
A. run the program in a debugger, say GDB, to get a exhaustive
stacktrace for hints about where to look at.
B. have a quick look at the library directly (the Use the
Source Luke strategy).
Since I
On Saturday, 7 December 2013 at 23:35:49 UTC, Ali Çehreli wrote:
On 12/07/2013 03:11 PM, Rémy Mouëza wrote:
the last pointer, `double * padfMaxBound` is actually a
pointer to an array
of 4 elements:
Great sleuthing! :)
This thread is a good example of C's Biggest Mistake:
std.algorithm.splitter seems to return all its return values as a
type Result, without quotes, and i dont not seem to be able to
cast it to string[] or int[] with cast(string[]) ( or even cast
(string) - i tried that too).
I tried to use a function
void function(T, R)(T arr, out R output)
{
On 12/08/2013 12:24 AM, seany wrote:
std.algorithm.splitter seems to return all its return values as a type
Result, without quotes, and i dont not seem to be able to cast it to
string[] or int[] with cast(string[]) ( or even cast (string) - i tried
that too).
I tried to use a function
... I thought I did, but now I'm up against an interesting
conundrum: while equality == comparison can fail here for
32-bit, isIdentical comparison can fail even for 64-bit,
although only for the release-mode build.
What's particularly odd is that if before calling
assert(isIdentical(
O_O
with that knowledge, would also be possible to define new types
(not aliases, but new encapsulated types) representing things
such as Graph, Ring, Topology, surreal number, etc?
I dont find this in your book, would you consider either adding
this Volodemrot types, or in case they
Am Sun, 08 Dec 2013 09:24:53 +0100
schrieb seany se...@uni-bonn.de:
std.algorithm.splitter seems to return all its return values as a
type Result, without quotes, and i dont not seem to be able to
cast it to string[] or int[] with cast(string[]) ( or even cast
(string) - i tried that
Am Sun, 08 Dec 2013 05:49:34 +0100
schrieb Malkierian rhyd...@gmail.com:
On Saturday, 7 December 2013 at 23:18:18 UTC, Adam D. Ruppe wrote:
On Saturday, 7 December 2013 at 23:00:00 UTC, Malkierian wrote:
Is there anything in D that currently brings up a window to
find and choose a file,
Am Sun, 08 Dec 2013 09:59:55 +0100
schrieb seany se...@uni-bonn.de:
O_O
with that knowledge, would also be possible to define new types
(not aliases, but new encapsulated types) representing things
such as Graph, Ring, Topology, surreal number, etc?
All these Result types are simply
Am Sat, 07 Dec 2013 17:53:06 +0100
schrieb Frustrated c1514...@drdrb.com:
I have to process n arrays in some partial order. Instead of all
working only on the n arrays and reusing them, [...]
Wait, what partial order and how is it relevant? Who is all
in all working? Why only the n arrays, I
On 12/08/2013 12:59 AM, seany wrote:
I dont find this in your book, would you consider either adding this
Volodemrot types,
I think at least a short mention is in order. :)
There are two reasons why they don't appear in the book (yet):
1) They are not a proper language feature, rather a
Ali Çehreli:
When you eagerly need an actual array of the elements, call
std.array.array on Result:
import std.array;
import std.algorithm;
void main()
{
auto input = hello world;
auto splittedWords = input.splitter(' ').array;
Or just use the eager split() function.
Bye,
Jay Norwood:
enum Suit { spades, hearts=4, diamonds=10, clubs }
foreach (i, member; EnumMembers!Suit)
Here 'i' is the index of the enumeration type tuple.
This code lacks the [] I added in my code, so your foreach is a
static one. To tell them apart when I read the code I sometimes
On 12/08/2013 01:55 AM, Joseph Rushton Wakeling wrote:
back to my original solution of approxEqual
I don't know whether it helps here but just to complete the picture,
there is also std.math.feqrel:
http://dlang.org/phobos/std_math.html#.feqrel
Ali
On 12/08/2013 12:16 AM, Craig Dillabaugh wrote:
I cannot for the life of me figure out why I didn't think to check that!
D has already ruined your mind! :p
Ali
On Sunday, 8 December 2013 at 11:02:40 UTC, Ali Çehreli wrote:
(I remember Andrei's original newsgroup post about this
discovery but I cannot find it at this time.)
http://www.digitalmars.com/d/archives/digitalmars/D/announce/Voldemort_Types_in_D_23511.html
this?
consider the follwoing:
import tango.io.Stdout, tango.io.Path, tango.text.Util;
import std.algorithm, std.string , std.stdio, std.array,
std.conv, std.regex, std.typecons;
//i know al imports are not necessary for this example, just ^c^v
from my actual code
alias string[] surSegments
On 08/12/13 12:13, Ali Çehreli wrote:
I don't know whether it helps here but just to complete the picture, there is
also std.math.feqrel:
http://dlang.org/phobos/std_math.html#.feqrel
Thanks! :-) Checking the value of feqrel followed by isIdentical looks like it
might work. (OK,
I'm trying my hand at a simple pesky bug in DMD.
About to run test suite but must be doing something wrong.
Any help would be appreciated.
I followed this:
http://wiki.dlang.org/Building_DMD#How_to_run_the_test_suite_in_dmd.2Ftest
And here is what I get (I'm on 64-bit Ubuntu):
On 12/08/2013 03:51 AM, seany wrote:
consider the follwoing:
import tango.io.Stdout, tango.io.Path, tango.text.Util;
import std.algorithm, std.string , std.stdio, std.array, std.conv,
std.regex, std.typecons;
//i know al imports are not necessary for this example, just ^c^v from
my
On 12/08/2013 03:41 AM, seany wrote:
On Sunday, 8 December 2013 at 11:02:40 UTC, Ali Çehreli wrote:
(I remember Andrei's original newsgroup post about this discovery but
I cannot find it at this time.)
On 12/8/2013 6:12 AM, Mafi wrote:
On Friday, 6 December 2013 at 16:54:14 UTC, Jacob Carlborg wrote:
I would say that linking order shouldn't matter. But for some reason
it does. This not really my area of expertise but I know that others
have had the same problem. You can try and search the
On Sunday, 8 December 2013 at 13:47:43 UTC, Ali Çehreli wrote:
On 12/08/2013 03:51 AM, seany wrote:
consider the follwoing:
import tango.io.Stdout, tango.io.Path, tango.text.Util;
import std.algorithm, std.string , std.stdio, std.array,
std.conv,
std.regex, std.typecons;
//i know al
On Sun, Dec 8, 2013 at 9:59 AM, seany se...@uni-bonn.de wrote:
O_O
with that knowledge, would also be possible to define new types (not
aliases, but new encapsulated types) representing things such as Graph,
Ring, Topology, surreal number, etc?
Other posters already answered your questions
On Sunday, 8 December 2013 at 09:17:37 UTC, Marco Leise wrote:
Maybe it requires a working Windows® event loop in your
application, as is typical for GUI applications on any
platform. Windows typically generate all sorts of events, like
mouse clicks, key strokes, resize events etc. They add up
On Sunday, 8 December 2013 at 10:31:32 UTC, Mathias LANG wrote:
Thank you, and yazd, it did the trick.
May I ask why I don't want to call it multiple time though ?
From the sentence If the runtime was already successfully
initialized this returns true., I though this was handled in
some way.
Hello all,
I have a challenge, which is this: I'd like to have a public property which will
return a reference to an internally stored class instance.
ref MyClass myProperty() @property
{
...
}
However, this runs into a problem: I can't use static to internally store a
On Sunday, 8 December 2013 at 00:43:51 UTC, Jesse Phillips wrote:
What is wrong with the current template which returns an
immutable delegate type? It still store you're immutable member
function.
It composes the wrong type. It composes a type that has different
constness than the target
On Sunday, 8 December 2013 at 04:49:35 UTC, Malkierian wrote:
Any idea why it doesn't work the first time, but then does the
second and freezes?
Could be a missing argument to the function, I did a quick test
on Windows XP and it looks like you're on Vista.
Later today, I'll be on my other
I see comments about enums being somehow implemented as tuples,
and comments about tuples somehow being implemented as structs,
but I couldn't find examples of static initialization of arrays
of either.
Finally after playing around with it for a while, it appears this
example below works for
Jay Norwood:
I see comments about enums being somehow implemented as tuples,
Enums are usually implemented as ints, unless you specify a
different type.
and comments about tuples somehow being implemented as structs,
Phobos Tuples are implemented with structs.
but I couldn't find
On 12/08/2013 10:00 AM, Joseph Rushton Wakeling wrote:
I have a challenge, which is this: I'd like to have a public property
which will return a reference to an internally stored class instance.
ref MyClass myProperty() @property
{
...
}
First, the usual question:
Yes, thanks, that syntax does work for the initialization.
The C syntax that failed for me was using the curly brace form
shown in the following link.
http://www.c4learn.com/c-programming/c-initializing-array-of-structure/
Also, I think I was trying forms of defining the struct and
On 08/12/13 21:12, Ali Çehreli wrote:
In any case, I think class static this is the solution:
I think I may have misled you by talking about properties, because I _don't_
mean a property of a class. I mean a public standalone function that is marked
as a @property, which returns a
Hmm, I just tried from my Windows 7 computer and it worked. If
you do my sample program without changes
http://arsdnet.net/dcode/open.d
does it work, or is the problem after copy/pasting it into the
rest of your program? Also are you compiling 64 bit? I only tried
32 bit since my laptop has
Jay Norwood:
If that is so, then the C initialization of an array with an
unnamed struct type, like this, would require a struct type
name.
static struct { int i; long lv;} suits[3] = {{1, 2L},{2,
4L},{3,9L}};
Giving a struct a name is often a good idea. But if you don't
want to name it,
On Sunday, 8 December 2013 at 21:32:35 UTC, Joseph Rushton
Wakeling wrote:
On 08/12/13 21:12, Ali Çehreli wrote:
In any case, I think class static this is the solution:
I think I may have misled you by talking about properties,
because I _don't_ mean a property of a class. I mean a public
foreach (immutable member; suits)
Sometimes you have to use:
foreach (const member; suits)
Bye,
bearophile
On Sunday, 8 December 2013 at 22:26:11 UTC, Adam D. Ruppe wrote:
Hmm, I just tried from my Windows 7 computer and it worked. If
you do my sample program without changes
http://arsdnet.net/dcode/open.d
does it work, or is the problem after copy/pasting it into the
rest of your program? Also
On Sunday, 8 December 2013 at 23:17:46 UTC, Malkierian wrote:
On Sunday, 8 December 2013 at 22:26:11 UTC, Adam D. Ruppe wrote:
Hmm, I just tried from my Windows 7 computer and it worked.
If you do my sample program without changes
http://arsdnet.net/dcode/open.d
does it work, or is the
On Sunday, 8 December 2013 at 22:30:25 UTC, bearophile wrote:
Try:
member.writeln;
Bye,
bearophile
yeah, that's pretty nice.
module main;
import std.stdio;
void main()
{
struct Suit {string nm; int val; int val2; string shortNm;};
static Suit[5] suits = [
On Sunday, 8 December 2013 at 23:32:54 UTC, Malkierian wrote:
On Sunday, 8 December 2013 at 23:17:46 UTC, Malkierian wrote:
On Sunday, 8 December 2013 at 22:26:11 UTC, Adam D. Ruppe
wrote:
Hmm, I just tried from my Windows 7 computer and it worked.
If you do my sample program without changes
static Suit[5] suits = [
{spades,1,6,spd},
{hearts,4,10,hrt},
{hearts2,4,10,hrt2},
{diamonds,10,16,dmd},
{clubs,11,17,clb}
Also, in D it's better to put a space after every comma, to
increase readability a
Jay Norwood:
struct Suit {string nm; int val; int val2; string shortNm;};
You have missed my suggestions above regarding the struct :-)
Look at this:
void main() {
int x;
struct Foo1 {
int bar1() { return x; }
}
pragma(msg, Foo1.sizeof);
static struct Foo2 {
It looks like the writeln() does a pretty good job, even for enum
names.
I also saw a prettyprint example that prints the structure member
name, and compared its output.
http://forum.dlang.org/thread/ip23ld$93u$1...@digitalmars.com
module main;
import std.stdio;
import std.traits;
void
Jay Norwood:
Using enums, despite their problems, if often better than strings.
static Suits[] suits = [
{Suit.spades, 1, 6, SuitShort.spd},
{Suit.hearts, 4, 10, SuitShort.hrt},
{Suit.diamonds, 4, 10, SuitShort.dmd},
Hi,
I am having some problems trygin to pass regular expressions to a
webpage encoded in Latin1. I have unsuccessfully tried to convert it to
UTF8 before passing the regular expression.
Initially I tried to do something like this:
auto input = readText(myfile.htm);
auto output =
On Monday, 9 December 2013 at 02:40:29 UTC, Hugo Florentino wrote:
auto input = readText(myfile.htm);
Don't use readText if it isn't utf-8; readtext assumes it is utf
8.
I've never actually used std.encoding (I wrote my own encoding
module for my dom.d, which I used for website scraping
I wonder if your other DSFML thingy use threads or something...
the GetOpenFileName function blocks until the user makes their
choice. So that could be stalling the SFML event loop, or maybe
having threading issues. I don't know. But I get the feeling that
the problem is one of these two
[DMD 2.064.2]
Hello,
I've been strugling with a solution before bothering you guys
here (again). I have my own complex code but i made a VERY simple
test case to reproduce my problem, here's the code:
private import std.stdio;
class A
{
private const ubyte* data;
private
Duhhh! i got the pink avatar by default. That sucks. Pink is just
not my color.
On Mon, 09 Dec 2013 03:44:19 +0100, Adam D. Ruppe wrote:
On Monday, 9 December 2013 at 02:40:29 UTC, Hugo Florentino wrote:
auto input = readText(myfile.htm);
Don't use readText if it isn't utf-8; readtext assumes it is utf 8.
I've never actually used std.encoding (I wrote my own encoding
On Monday, 9 December 2013 at 03:07:58 UTC, Hugo Florentino wrote:
Is there a way to detect the encoding prior to
typecasting/loading the file?
UTF-8 can be detected fairly reliably, but not much luck for
other encodings. A Windows-1258 and a Latin1 file, for example,
are usually fairly
Easy problem in class B: data is null!
On Monday, 9 December 2013 at 02:53:01 UTC, Heinz wrote:
class B
{
private const ubyte* data;
private ubyte[] abc;
this()
{
data = cast(const ubyte*)abc.ptr;
}
Since abc isn't initialized
On Mon, 09 Dec 2013 04:19:51 +0100, Adam D. Ruppe wrote:
On Monday, 9 December 2013 at 03:07:58 UTC, Hugo Florentino wrote:
Is there a way to detect the encoding prior to typecasting/loading
the file?
UTF-8 can be detected fairly reliably, but not much luck for other
encodings. A Windows-1258
On Monday, 9 December 2013 at 03:33:46 UTC, Hugo Florentino wrote:
Coud this work using scope instead of try/catch?
Maybe, but I don't think it would be very pretty. Really, I think
validate should return a bool instead of throwing, but since it
doesn't the try/catch is as close as it gets.
Thanks. That's looking pretty clean.
I had already tried the shorter enum names without using the with
statement, and it failed to compile. I thought it might work
since the struct definition already specifies the enum type for
the two members.
with (Suit) with (SuitShort)
{
On Monday, 9 December 2013 at 02:45:48 UTC, Adam D. Ruppe wrote:
I wonder if your other DSFML thingy use threads or something...
the GetOpenFileName function blocks until the user makes their
choice. So that could be stalling the SFML event loop, or maybe
having threading issues. I don't
I notice that if Suit and SuitShort have an enum with the same
name, then you still have to fully qualify the enum names when
using the with statement. So, for example, if spd in SuitShort
was renamed spades, the first entry in the array initialization
would have to be {Suit.spades, 1, 6,
On 12/08/2013 07:24 PM, Adam D. Ruppe wrote:
Easy problem in class B: data is null!
On Monday, 9 December 2013 at 02:53:01 UTC, Heinz wrote:
class B
{
private const ubyte* data;
private ubyte[] abc;
this()
{
data = cast(const ubyte*)abc.ptr;
}
Since abc isn't
Hello,
The following code snippet fails to compile on ldc2 (0.12.1), but
successfully compiles on dmd 2.064.2 :
struct Particle {
double x,y,z,w,x2;
this(double[] arr) {
x = arr[0]; y = arr[1]; z=arr[2]; w=arr[3];
x2 = x*x + y*y + z*z;
}
On Monday, 9 December 2013 at 04:01:54 UTC, Malkierian wrote:
On Monday, 9 December 2013 at 02:45:48 UTC, Adam D. Ruppe wrote:
I wonder if your other DSFML thingy use threads or something...
the GetOpenFileName function blocks until the user makes their
choice. So that could be stalling the
Just a quick follow-up : replacing the array operation by a
foreach works around this issue, but I don't understand why it
failed in the first place.
On Monday, 9 December 2013 at 04:26:01 UTC, Nikhil Padmanabhan
wrote:
Hello,
The following code snippet fails to compile on ldc2 (0.12.1),
On Monday, 9 December 2013 at 04:52:21 UTC, Malkierian wrote:
On Monday, 9 December 2013 at 04:01:54 UTC, Malkierian wrote:
On Monday, 9 December 2013 at 02:45:48 UTC, Adam D. Ruppe
wrote:
I wonder if your other DSFML thingy use threads or
something...
the GetOpenFileName function blocks
On Monday, 9 December 2013 at 05:09:42 UTC, Jeremy DeHaan wrote:
On Monday, 9 December 2013 at 04:52:21 UTC, Malkierian wrote:
On Monday, 9 December 2013 at 04:01:54 UTC, Malkierian wrote:
On Monday, 9 December 2013 at 02:45:48 UTC, Adam D. Ruppe
wrote:
I wonder if your other DSFML thingy use
On 09/12/13 01:24, Ali Çehreli wrote:
On 12/08/2013 02:40 PM, qznc wrote:
I understand you are talking about the Singleton design pattern.
You might want to look how std.parallelism does it with the default
global thread pool.
Does D has somtething similar ?
http://code.google.com/p/go-wiki/wiki/SimultaneousAssignment
I tried this way, but it not worked out.
if((int x = 10) 0) {
writefln(x is %s, x);
}
67 matches
Mail list logo