Here's the gist of what I'm trying to do.
https://gist.github.com/pontifechs/11169069
I'm getting an error I don't understand:
tinker.d(42): Error: mismatched function return type inference of
tinker.B and tinker.A
tinker.d(55): Error: template instance tinker.DynamicTuple!(A,
Matthew Dudley:
Also, as an aside, why can't tuples be indexed dynamically?
Most of my problems with this have been because you apparently
can't.
Think about how D tuples are implemented, they are essentially
structs. Every tuple element can have a different type and to be
represented in
What should I add in the D program in GNU/Linux to throw
exception if I have segmentation fault error? I read somewhere
that it's possible, but I don't know how to do it.
Wow, joiner is much slower than join. Such a small choice can
make this big of a difference. Not at all expected, since the
lazy calls, I thought, were considered to be more efficient.
This is with ldc2 -O2.
jay@jay-ubuntu:~/ec_ddt/workspace/diamond/source$ ./main
1/dev/null
brad: time:
On Mon, 21 Apr 2014 23:25:39 -0400, Taylor Hillegeist
taylorh...@gmail.com wrote:
So I find myself Doing this kind of thing very frequently. I have a
Array of Somethings and i want to see if something specific is inside
the array. I wrote a template for it. but is this the best way to do
Hi there,
I recently read the 'More Templates' chapter of Ali's book (-- thanks
for that ;) ).
At the section 'Named constraints', there were a definition like this:
template isUsable(T)
{
enum isUsable = is ( typeof(
{
T obj;
obj.call();
obj.otherCall(1);
You should write and register a signal handler. Implementation
for x86-32 was posted here.
On Tuesday, 22 April 2014 at 09:58:45 UTC, ilya-stromberg wrote:
What should I add in the D program in GNU/Linux to throw
exception if I have segmentation fault error? I read somewhere
that it's possible, but I don't know how to do it.
etc.linux.memoryerror
Just remember that it is more of
On 4/22/14, Tim Holzschuh via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com wrote:
What does (inout int = 0) mean/affect here?
This was asked recently, see my reponse here:
http://forum.dlang.org/post/mailman.102.1396007039.25518.digitalmars-d-le...@puremagic.com
On Tue, 22 Apr 2014 10:58:41 -0400, Andrej Mitrovic via
Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote:
On 4/22/14, Tim Holzschuh via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com wrote:
What does (inout int = 0) mean/affect here?
This was asked recently, see my
Not sure what InputRange is defined as atm, but I don't think
anything should have to define init to be a valid inputrange.
Hi,
I just stumbled about this issue with array of interface. I want
to pass several objects (C and D) which shares the same interface A.
It seems somehow cumbersome that it only works if there is a cast on
the first element of the array.
interface A{}
class B: A{}
class C: B{};
class D: B{};
On Tuesday, 22 April 2014 at 15:06:34 UTC, Steven Schveighoffer
wrote:
Note, is the r2 = R.init needed? Not sure.
Yes: It R2 has no default init, or is an immutable, then that
line will fail to compile.
On Tuesday, 22 April 2014 at 15:19:55 UTC, Andre wrote:
Is the cast really needed?
It's a known issue and a filed bug report. I don't have the Issue
number at hand though, someone else will likely provide it.
On Tuesday, 22 April 2014 at 05:05:30 UTC, Jay Norwood wrote:
On Monday, 21 April 2014 at 08:26:49 UTC, monarch_dodra wrote:
The two key points here, first, is to avoid using appender.
Second, instead of having two buffer: and **\n,
and two do two slice copies, to only have 1 buffer
Am 22.04.2014 17:23, schrieb Andrej Mitrovic:
On Tuesday, 22 April 2014 at 15:19:55 UTC, Andre wrote:
Is the cast really needed?
It's a known issue and a filed bug report. I don't have the Issue number
at hand though, someone else will likely provide it.
Nice to hear that it is not by
On Tuesday, 22 April 2014 at 11:41:41 UTC, Jay Norwood wrote:
Wow, joiner is much slower than join. Such a small choice can
make this big of a difference. Not at all expected, since the
lazy calls, I thought, were considered to be more efficient.
This is with ldc2 -O2.
Yeah, that's
On Tue, 22 Apr 2014 11:15:14 -0400, monarch_dodra monarchdo...@gmail.com
wrote:
On Tuesday, 22 April 2014 at 15:06:34 UTC, Steven Schveighoffer wrote:
Note, is the r2 = R.init needed? Not sure.
Yes: It R2 has no default init, or is an immutable, then that line will
fail to compile.
I
On Tue, 22 Apr 2014 11:19:57 -0400, Andre an...@s-e-a-p.de wrote:
Hi,
I just stumbled about this issue with array of interface. I want
to pass several objects (C and D) which shares the same interface A.
It seems somehow cumbersome that it only works if there is a cast on
the first element of
On 4/22/14, Steven Schveighoffer via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com I think this can be fixed a
different way.
Feel free to file a bug / make a pull. :
On Tuesday, 22 April 2014 at 15:30:36 UTC, Steven Schveighoffer
wrote:
On Tue, 22 Apr 2014 11:15:14 -0400, monarch_dodra
monarchdo...@gmail.com wrote:
On Tuesday, 22 April 2014 at 15:06:34 UTC, Steven
Schveighoffer wrote:
Note, is the r2 = R.init needed? Not sure.
Yes: It R2 has no default
Andre:
Nice to hear that it is not by design but will be fixed.
See:
https://issues.dlang.org/show_bug.cgi?id=3543
Bye,
bearophile
On Tuesday, 22 April 2014 at 14:49:58 UTC, Dicebot wrote:
On Tuesday, 22 April 2014 at 09:58:45 UTC, ilya-stromberg wrote:
What should I add in the D program in GNU/Linux to throw
exception if I have segmentation fault error? I read somewhere
that it's possible, but I don't know how to do it.
On Tuesday, 22 April 2014 at 15:47:37 UTC, ilya-stromberg wrote:
On Tuesday, 22 April 2014 at 14:49:58 UTC, Dicebot wrote:
On Tuesday, 22 April 2014 at 09:58:45 UTC, ilya-stromberg
wrote:
What should I add in the D program in GNU/Linux to throw
exception if I have segmentation fault error? I
I opened the following bug before reading reduce's documentation carefully:
https://issues.dlang.org/show_bug.cgi?id=12610
import std.stdio;
import std.algorithm;
void main()
{
int[] arr = [ 0 ];
int[1] seed;
int[] result = reduce!((sum, _) = sum[])(seed, arr);
writefln(%s,
On Tuesday, 22 April 2014 at 17:31:22 UTC, Ali Çehreli wrote:
I opened the following bug before reading reduce's
documentation carefully:
https://issues.dlang.org/show_bug.cgi?id=12610
import std.stdio;
import std.algorithm;
void main()
{
int[] arr = [ 0 ];
int[1] seed;
int[]
On 04/22/2014 07:07 AM, Tim Holzschuh via Digitalmars-d-learn wrote:
read the 'More Templates' chapter of Ali's book (-- thanks
for that ;) ).
Yay! :)
At the section 'Named constraints', there were a definition like this:
template isUsable(T)
{
enum isUsable = is ( typeof(
{
Am 22.04.2014 16:58, schrieb Andrej Mitrovic via Digitalmars-d-learn:
On 4/22/14, Tim Holzschuh via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com wrote:
What does (inout int = 0) mean/affect here?
This was asked recently, see my reponse here:
On 04/22/2014 11:03 AM, monarch_dodra wrote:
On Tuesday, 22 April 2014 at 17:31:22 UTC, Ali Çehreli wrote:
I opened the following bug before reading reduce's documentation
carefully:
https://issues.dlang.org/show_bug.cgi?id=12610
import std.stdio;
import std.algorithm;
void main()
{
On Tue, 22 Apr 2014 14:17:57 -0400, Ali Çehreli acehr...@yahoo.com wrote:
I don't think there is slicing an rvalue though. (?) reduce() is taking
a copy of the seed and then returning a slice to it because the user
slices it in their lambda. It effectively does the following, which
On Tue, 22 Apr 2014 11:36:07 -0400, monarch_dodra monarchdo...@gmail.com
wrote:
On Tuesday, 22 April 2014 at 15:30:36 UTC, Steven Schveighoffer wrote:
Also, an immutable can be initialized that way:
immutable int[] = int[].init;
Isn't that exactly R.init ?
Yes, you said if it's an
On Tue, 22 Apr 2014 14:47:19 -0400, monarch_dodra monarchdo...@gmail.com
wrote:
In this case no, but;
//
int[1] foo();
int[] a = foo();
//
*is* slicing an rvalue, and it *does* compile. I don't think there needs
to be escape analysis to catch this.
Oh yeah, that's bad.
-Steve
On Tuesday, 22 April 2014 at 18:34:47 UTC, Steven Schveighoffer
wrote:
On Tue, 22 Apr 2014 14:17:57 -0400, Ali Çehreli
acehr...@yahoo.com wrote:
I don't think there is slicing an rvalue though. (?) reduce()
is taking a copy of the seed and then returning a slice to it
because the user slices
On Tue, 22 Apr 2014 14:50:44 -0400, monarch_dodra monarchdo...@gmail.com
wrote:
On Tuesday, 22 April 2014 at 18:35:58 UTC, Steven Schveighoffer wrote:
On Tue, 22 Apr 2014 11:36:07 -0400, monarch_dodra
monarchdo...@gmail.com wrote:
On Tuesday, 22 April 2014 at 15:30:36 UTC, Steven
Hello,
I'm working on some code where I'm trying to generate structs
that map to JSON documents via a mixin. That part works except
when specific variable gets created. Below is the error that I'm
getting:
source/objects.d-mixin-70(75): Error: no identifier for
declarator string
Casey:
My question is, is there a way I can prevent this conflict from
occurring without affecting what the struct will look like?
The usual strategy is to append an underscore. (I think C# uses a
@ prefix).
Bye,
bearophile
On Tue, 22 Apr 2014 15:35:33 -0400, Casey sybra...@gmail.com wrote:
If I prefix all of the generated variables with an underscore, it works
fine. It looks like the variable delete is the issue. To me, it
looks like it's expecting some sort of delete method.
delete is a keyword, it cannot
On Tuesday, 22 April 2014 at 19:38:09 UTC, bearophile wrote:
Casey:
My question is, is there a way I can prevent this conflict
from occurring without affecting what the struct will look
like?
The usual strategy is to append an underscore. (I think C# uses
a @ prefix).
Bye,
bearophile
Casey:
I've done that, but then it changes the name which, from what
I've read in the documentation, means the JSON - object
conversion won't work since it won't see a variable named
delete.
Perhaps we need a built-in syntax solution as in C#, like a
$delete.
Bye,
bearophile
Perhaps we need a built-in syntax solution as in C#, like a
$delete.
So, two things:
1. I guess my current approach is screwed. I figured as much.
2. Seeing $delete makes me miss Perl/PHP variable naming. It
is one extra character, but it did make them stand out more.
Anyway, thanks.
On Tuesday, 22 April 2014 at 07:54:34 UTC, Matthew Dudley wrote:
Here's the gist of what I'm trying to do.
https://gist.github.com/pontifechs/11169069
I'm getting an error I don't understand:
tinker.d(42): Error: mismatched function return type inference
of tinker.B and tinker.A
41 matches
Mail list logo