On Tuesday, 1 April 2014 at 04:43:44 UTC, H. S. Teoh wrote:
On Mon, Mar 31, 2014 at 09:55:01PM +, monarch_dodra wrote:
On Monday, 31 March 2014 at 21:41:16 UTC, H. S. Teoh wrote:
>Argh, why is opSlice non-const? :-( Please file a bug.
If opSlice was const, then you'd get a const slice, wit
Ok, thought i did something wrong or got some wrong idea how it
should work.
OK, lazy me just read the std.satetime article again. It appears
the design is for no invalid values and it is currently a known
limitation due to CTFE.
---
d_time_nan There is no equivalent. SysTime.init, which has a null
TimeZone object, would be the closest, but once CTFE advances to
the
Still no luck:
import std.container;
import std.stdio;
void main()
{
DList!ubyte list1 = DList!ubyte();
list1 ~= cast(ubyte) 1;
list1 ~= cast(ubyte) 2;
list1 ~= cast(ubyte) 3;
foreach(ubyte item; list1[]) {
writeln(item);
}
}
/usr
Hi All,
I'm trying to use SysTime in a struct but I've noticed the
following:
(A) SysTime.init leads to a crash.
---
void main()
{
SysTime t;
writefln("t:%s", t);
}
% ./dtest
zsh: segmentation fault (core dumped) ./dtest
---
(B) Initialising a SysTime member directly fails
---
struc
On Mon, Mar 31, 2014 at 09:55:01PM +, monarch_dodra wrote:
> On Monday, 31 March 2014 at 21:41:16 UTC, H. S. Teoh wrote:
> >Argh, why is opSlice non-const? :-( Please file a bug.
>
> If opSlice was const, then you'd get a const slice, with const
> reference. You wouldn't even be able to iter
Kitchen Designer Hertfordshire. Thirty Ex Display Kitchens To
Clear. w.w.w-e.x.d.i.s.p.l.a.y.k.i.t.c.h.e.n.s.1-c.o-u.k. .£
5.9.5. Each with appliances.
I believe for this case you would want this:
JSONValue oJson = [ "myEntry": "MyText" ];
Yeah, and unfortunately, there is no that easy way to create an
empty "object" type json value though. (Yes, I had a need for
that). I needed to work around of that.
On Monday, 31 March 2014 at 19:05:11 UTC, Matt Soucy wrote:
On 03/31/2014 02:59 PM, nrgyzer wrote:
Hi guys,
I updated my dmd version from 2.0.63 to 2.0.65 and having some
trouble
with my JSON-definitions. The code below worked in 2.0.63 but
not in
2.0.65:
JSONValue oJson = JSONValue();
oJso
On 03/31/2014 04:01 PM, bearophile wrote:
Ali Çehreli:
statement.c:274: ErrorStatement::ErrorStatement(): Assertion
`global.gaggedErrors || global.errors' failed.
It's a little compiler bug, that should go in Bugzilla (even if perhaps
it was recently added).
https://d.puremagic.com/issues
Ali Çehreli:
statement.c:274: ErrorStatement::ErrorStatement(): Assertion
`global.gaggedErrors || global.errors' failed.
It's a little compiler bug, that should go in Bugzilla (even if
perhaps it was recently added).
Bye,
bearophile
On Monday, 31 March 2014 at 21:55:03 UTC, monarch_dodra wrote:
If opSlice was const, then you'd get a const slice, with const
reference. You wouldn't even be able to iterate on it.
const opSlice does not mean it returns a const(Range).
With some extra code, you could create some sort of "slice
You can't use reduce with a const seed.
This, surely, must be a compiler bug right?
/Per
On 03/31/2014 03:13 PM, bearophile wrote:
Nordlöw:
I'm trying to figure out how to use reduce with multiply funs.
Could someone please check the following. It looks like a compiler bug
on git head (DMD64 D Compiler v2.066-devel-75159e4):
import std.algorithm;
int foo(int value)
{
retu
Nordlöw:
I'm trying to figure out how to use reduce with multiply funs.
import std.algorithm: min, max, reduce;
import std.typecons: tuple, Unqual;
import std.range: isInputRange, ElementType;
/// Returns: Tuple of Minmum and Maximum Element in X.
auto minMax(alias F = min, alias G = max, R)(
On 31-3-2014 19:50, Jeroen Bollen wrote:
I am trying to foreach over a std.container.DList but it isn't working. I have
tried the following code: https://gist.github.com/Binero/f30e56351baf05f1a2ec
I am getting the following errors:
/usr/include/dlang/dmd/std/container.d(1925): Error: template
I'm trying to figure out how to use reduce with multiply funs.
Here's my try on minmaxElement:
import std.typecons: tuple;
/** Returns: Tuple of Minmum and Maximum Element in X. */
auto minmaxElement(alias F = min, alias G = max, R)(in R range)
@safe pure nothrow if (isInputRange!R)
{
On Monday, 31 March 2014 at 21:41:16 UTC, H. S. Teoh wrote:
Argh, why is opSlice non-const? :-( Please file a bug.
If opSlice was const, then you'd get a const slice, with const
reference. You wouldn't even be able to iterate on it.
With some extra code, you could create some sort of "slice
On 03/31/2014 10:50 AM, Jeroen Bollen wrote:
I am trying to foreach over a std.container.DList but it isn't working.
I have tried the following code:
https://gist.github.com/Binero/f30e56351baf05f1a2ec
I am getting the following errors:
/usr/include/dlang/dmd/std/container.d(1925): Error: templ
On Mon, Mar 31, 2014 at 07:30:11PM +, Jeroen Bollen wrote:
> On Monday, 31 March 2014 at 19:26:23 UTC, Jeroen Bollen wrote:
> >On Monday, 31 March 2014 at 18:24:39 UTC, H. S. Teoh wrote:
> >>On Mon, Mar 31, 2014 at 05:50:16PM +, Jeroen Bollen wrote:
> >>>I am trying to foreach over a std.co
On Monday, 31 March 2014 at 21:05:11 UTC, bearophile wrote:
monarch_dodra:
bearophile made a suggestion that we should deprecate this.
https://d.puremagic.com/issues/show_bug.cgi?id=6367
It goes against the idea of tuple. No language that I know
(Haskell, Rust, F#, Python, and more) that has
No language that I know (Haskell, Rust, F#, Python, and more)
that has tuples supports the initialization of a n-tuple with a
scalar value.
In Python there is a way to build a n-tuple from a 1-tuple, but
the seed is not a scalar, and this is an explicit syntax:
(5,) * 3
(5, 5, 5)
Bye,
bea
monarch_dodra:
bearophile made a suggestion that we should deprecate this.
https://d.puremagic.com/issues/show_bug.cgi?id=6367
It goes against the idea of tuple. No language that I know
(Haskell, Rust, F#, Python, and more) that has tuples supports
the initialization of a n-tuple with a scal
On Mon, 31 Mar 2014 14:58:30 -0400, anonymous wrote:
Hi,
I'm new to D and played a bit with templates and delegates.
Now i discovered some behaviore that i don't understand.
Can somebody explain me why i get two different outputs?
import std.stdio;
interface A(T){
bool GetBool();
If you declare an instance of a tuple, eg TypeTuple!(int, int,
int), you can initialize all members from a single argument. EG:
TypeTuple!(int, int, int) a = 5;
bearophile made a suggestion that we should deprecate this.
https://d.puremagic.com/issues/show_bug.cgi?id=6367
I'd like to know if t
If not, what would it require to implement it?
That would be an interesting task to fix :)
DMD source references anyone?
On Mon, 31 Mar 2014 18:58:30 +, anonymous wrote:
> Hi,
> I'm new to D and played a bit with templates and delegates.
> Now i discovered some behaviore that i don't understand. Can somebody
> explain me why i get two different outputs?
>
>
> import std.stdio;
>
>
> interface A(T){
> b
If they are range-checked, it would be a good addition to the
optimizer to remove them. My guess is that it is range-checked.
$/n is of course always within range if n is positive integer >=
1.
But what about in the general indexing/slicing case? In that case
it would be useful if we could
On Monday, 31 March 2014 at 17:25:58 UTC, Marco Leise wrote:
Am Mon, 31 Mar 2014 04:06:38 +
schrieb "Joel" :
I've got a program that uses user input, but I'm having
trouble with it.
Here's an example, the unenclosed numbers (1 2 3 in example)
add entries:
0 Achievement
1 2 3 c"Won!" st
Hi guys,
I updated my dmd version from 2.0.63 to 2.0.65 and having some
trouble with my JSON-definitions. The code below worked in 2.0.63
but not in 2.0.65:
JSONValue oJson = JSONValue();
oJson.type = JSON_TYPE.OBJECT; // FAILS
oJson.object["myEntry"] = JSONValue();
oJson.object["myEntry"].ty
Still not working:
https://gist.github.com/Binero/f30e56351baf05f1a2ec
/usr/include/dlang/dmd/std/container.d(1925): Error: template
std.container.DList!ubyte.DList.insertBeforeNode cannot deduce
function from argument types !()(typeof(null), int), candidates
are:
/usr/include/dlang/dmd/std/co
On Mon, 31 Mar 2014 15:05:10 -0400, Matt Soucy wrote:
> I believe that this was simplified in recent releases, so one only needs
> to do the following:
>
> JSONValue oJson;
> oJson.object["myEntry"] = "MyText";
>
> (Untested but I believe this is how it's supposed to be now)
That's correct, the
Oops, the 'c"Won!"' shouldn't be there, I forgot to use it.
On Monday, 31 March 2014 at 19:23:17 UTC, Joel wrote:
On Monday, 31 March 2014 at 17:25:58 UTC, Marco Leise wrote:
Am Mon, 31 Mar 2014 04:06:38 +
schrieb "Joel" :
I've got a program that uses user input, but I'm having
trouble wi
Hi,
I'm new to D and played a bit with templates and delegates.
Now i discovered some behaviore that i don't understand.
Can somebody explain me why i get two different outputs?
import std.stdio;
interface A(T){
bool GetBool();
T getT();
}
class C:A!(double){
override
On 03/31/2014 02:59 PM, nrgyzer wrote:
> Hi guys,
>
> I updated my dmd version from 2.0.63 to 2.0.65 and having some trouble
> with my JSON-definitions. The code below worked in 2.0.63 but not in
> 2.0.65:
>
> JSONValue oJson = JSONValue();
> oJson.type = JSON_TYPE.OBJECT; // FAILS
> oJson.object
On Monday, 31 March 2014 at 18:24:39 UTC, H. S. Teoh wrote:
On Mon, Mar 31, 2014 at 05:50:16PM +, Jeroen Bollen wrote:
I am trying to foreach over a std.container.DList but it isn't
working. I
have tried the following code:
[...]
Maybe try using opSlice:
DList myList;
for
On Monday, 31 March 2014 at 19:26:23 UTC, Jeroen Bollen wrote:
On Monday, 31 March 2014 at 18:24:39 UTC, H. S. Teoh wrote:
On Mon, Mar 31, 2014 at 05:50:16PM +, Jeroen Bollen wrote:
I am trying to foreach over a std.container.DList but it
isn't working. I
have tried the following code:
[.
On Saturday, 29 March 2014 at 05:01:14 UTC, Gary Miller wrote:
I've been reading through and trying various code fragments to
pull the system date/time in and format it as a string for
display on the console.
Here's a good primer on the datetime module:
http://dlang.org/intro-to-datetime.html
On Saturday, 29 March 2014 at 05:01:14 UTC, Gary Miller wrote:
I've been reading through and trying various code fragments to
pull the system date/time in and format it as a string for
display on the console.
I only need it down to the second and from my current machine
so I don't need to use
I've been reading through and trying various code fragments to
pull the system date/time in and format it as a string for
display on the console.
I only need it down to the second and from my current machine so
I don't need to use any of the more accurate clocks used for
benchmarking right no
On Mon, Mar 31, 2014 at 05:50:16PM +, Jeroen Bollen wrote:
> I am trying to foreach over a std.container.DList but it isn't working. I
> have tried the following code:
[...]
Maybe try using opSlice:
DList myList;
foreach (e; myList[]) { ... }
?
T
--
Three out of two peopl
I am trying to foreach over a std.container.DList but it isn't
working. I have tried the following code:
https://gist.github.com/Binero/f30e56351baf05f1a2ec
I am getting the following errors:
/usr/include/dlang/dmd/std/container.d(1925): Error: template
std.container.DList!ubyte.DList.insertB
Am Mon, 31 Mar 2014 05:09:22 +
schrieb "ed" :
> Hi,
>
> Just wondering what the best replacement for C timeval is in D.
> I'm looking at std.datetime.SysTime, but std.datetime is huge so
> I'm not sure.
>
> Thanks,
> ed
If you just need to time something, TickDuration from
core.time is an
Am Mon, 31 Mar 2014 04:06:38 +
schrieb "Joel" :
> I've got a program that uses user input, but I'm having trouble
> with it.
>
> Here's an example, the unenclosed numbers (1 2 3 in example) add
> entries:
>
> 0 Achievement
> 1 2 3 c"Won!" st"4 5 6" <- user input
>
> (create 3 entries all
Am 31.03.2014 08:06, schrieb monarch_dodra:
On Monday, 31 March 2014 at 01:03:22 UTC, Carl Sturtivant wrote:
What about destructors, are they always called, or is this another
optimization if the struct is in it's default .init state?
In any case, there should be 1 destructor call for every ob
On Sunday, 30 March 2014 at 08:25:43 UTC, Andre Artus wrote:
Considering the international spread of D users I find it
surprising that the date & time formatting functions in phobos
are not localizable.
Formatting should confined to presentation tier: GUI controls,
web page generation and must
On Sun, 30 Mar 2014 15:40:43 -0400, Nordlöw wrote:
Does DMD currently avoid range checks in array slice expressions such as
f(x[0..$/2])
f(x[$/2..$])
typically found in divide-and-conquer algorithms such as quicksort?
If they are range-checked, it would be a good addition to the optimizer t
On Sun, 30 Mar 2014 12:09:35 -0400, Matt wrote:
I have little experience in multi-threading programming, and was digging
into std.concurrency, but I don't really understand the Condition class
as it was used there. Could someone provide a bare-bones use of this
class? I would be much oblig
Here's the issue:
http://d.puremagic.com/issues/show_bug.cgi?id=12498
Please ignore the last example above, and look at the one in
Bugzilla.
On Monday, 31 March 2014 at 11:08:18 UTC, Olav Lindekleiv wrote:
On Monday, 31 March 2014 at 11:02:24 UTC, bearophile wrote:
Olav Lindekleiv:
I hope
On Monday, 31 March 2014 at 11:02:24 UTC, bearophile wrote:
Olav Lindekleiv:
I hope someone with more D experience can tell me what's going
on here, and how to fix it.
It's a compiler bug. I suggest to minimize manually the example
code as much as possible, and then add it to Bugzilla.
Bye
Olav Lindekleiv:
I hope someone with more D experience can tell me what's going
on here, and how to fix it.
It's a compiler bug. I suggest to minimize manually the example
code as much as possible, and then add it to Bugzilla.
Bye,
bearophile
I've been experimenting with D for a little while now. For the
most part, I've been able get help from the language/library
reference and IRC. But not this time.
So here's the thing: http://dpaste.dzfl.pl/14680a8cec77
I've run it through Dustmite to reduce it to a smaller chunk of
code. It ru
52 matches
Mail list logo