I'm guessing I have to use a "mixin" mixin for this, but...
there's no way to do something like this is there?
template TFoo(T) {
struct T {
int a;
int b;
}
T obj;
}
TFoo!Derp;
Derp bar;
Neither templates, nor mixin templates seem capable of this. Easy
enough to use mixin, with tokenize
On 05/02/16 8:41 PM, cy wrote:
I'm guessing I have to use a "mixin" mixin for this, but... there's no
way to do something like this is there?
template TFoo(T) {
struct T {
int a;
int b;
}
T obj;
}
TFoo!Derp;
Derp bar;
Neither templates, nor mixin templates seem capable of this. Easy en
On Wednesday, 3 February 2016 at 11:09:00 UTC, Ola Fosheim
Grøstad wrote:
Is there some reliable way to detect that a destructor is
called because of exception unwinding?
I basically want to change behaviour within a destructor based
on whether the destructor is called as a result of a regular
On Thursday, 4 February 2016 at 15:32:48 UTC, Artur Skawina wrote:
void print(A...)(A a) {
foreach (N, ref e; a)
write(e, N==A.length-1?"\n":" ");
}
will be unrolled at compile time
Mind if I elaborate on this a bit? If that is unrolled, I
understand it will unroll into
On Friday, 5 February 2016 at 06:52:11 UTC, Enjoys Math wrote:
I have two spin buttons connected to the width and height of 2d
objects in a scene. Using
mixin std.signals.Signal!(double, double) dimentionChanged;
and there is a growing delay that happens not caused by the
rendering cod
I have two spin buttons connected to the width and height of 2d
objects in a scene. Using
mixin std.signals.Signal!(double, double) dimentionChanged;
and there is a growing delay that happens not caused by the
rendering code, the transform code, or the triggering code (I
used a timer t
On Friday, 5 February 2016 at 06:23:09 UTC, Daniel Kozak wrote:
V Fri, 05 Feb 2016 03:47:40 +
tcak via Digitalmars-d-learn
napsáno:
[...]
Did you try catch Throwable instead of Exception?
Undid the fix, and wrapped the problem causing function call with
try-catch-Throwable, it is caug
V Fri, 05 Feb 2016 03:47:40 +
tcak via Digitalmars-d-learn
napsáno:
> On Thursday, 4 February 2016 at 22:27:31 UTC, Ali Çehreli wrote:
> > On 02/04/2016 12:25 PM, tcak wrote:
> >
> > > void threadFunc(){
> > > scope(exit){
> > > writeln("Leaving 2: ", stopRequested);
> > >
V Fri, 05 Feb 2016 05:48:27 +
tcak via Digitalmars-d-learn
napsáno:
> On Friday, 5 February 2016 at 03:47:40 UTC, tcak wrote:
> > On Thursday, 4 February 2016 at 22:27:31 UTC, Ali Çehreli wrote:
> >> On 02/04/2016 12:25 PM, tcak wrote:
> >>
> >> > [...]
> >>
> >> That would happen when
On Friday, 5 February 2016 at 03:47:40 UTC, tcak wrote:
On Thursday, 4 February 2016 at 22:27:31 UTC, Ali Çehreli wrote:
On 02/04/2016 12:25 PM, tcak wrote:
> [...]
That would happen when there is an exception.
> [...]
If a thread is terminated with an exception, its stack is
unwound and un
On Friday, 5 February 2016 at 05:18:01 UTC, Saurabh Das wrote:
[...]
Apologies for spamming. This is an improved implementation:
@property
Tuple!(sliceSpecs!(from, to)) slice(size_t from, size_t
to)() @safe const
if (from <= to && to <= Types.length)
{
On Friday, 5 February 2016 at 05:18:01 UTC, Saurabh Das wrote:
[...]
PS: Additionally, '@trusted' can now be substituted with '@safe'.
On Thursday, 4 February 2016 at 17:52:16 UTC, Marco Leise wrote:
https://issues.dlang.org/show_bug.cgi?id=15645
Is this a possible fixed implementation? :
@property
Tuple!(sliceSpecs!(from, to)) slice(size_t from, size_t
to)() @trusted const
if (from <= to && to <= Ty
On Thursday, 4 February 2016 at 22:27:31 UTC, Ali Çehreli wrote:
On 02/04/2016 12:25 PM, tcak wrote:
> void threadFunc(){
> scope(exit){
> writeln("Leaving 2: ", stopRequested);
> }
>
>
> while( !stopRequested ){
> /* THERE IS NO "RETURN" HERE AT ALL */
> }
>
>
On Thursday, 4 February 2016 at 17:52:16 UTC, Marco Leise wrote:
https://issues.dlang.org/show_bug.cgi?id=15645
Thank you.
I understood why this is happening from your explanation in the
bug report.
On 02/04/2016 12:25 PM, tcak wrote:
> void threadFunc(){
> scope(exit){
> writeln("Leaving 2: ", stopRequested);
> }
>
>
> while( !stopRequested ){
> /* THERE IS NO "RETURN" HERE AT ALL */
> }
>
> writeln("Leaving 1: ", stopRequested);
> }
>
>
>
> While loop is r
On Thursday, 4 February 2016 at 14:25:21 UTC, bachmeier wrote:
Unfortunately there is no such thing and it is unlikely to
exist in the next decade.
Well, it is probably not the best point in time to have absolute
beginners use D anyway. But a well commented library, that don't
focus on perfor
On Thursday, 4 February 2016 at 20:25:27 UTC, tcak wrote:
Is there any known reason for a thread to suddenly stop like
this?
Your listener object can be GC-ed. Check if you have any live ref
to it.
I have implemented a standalone HTTP server. So everything is in
single executable. Requests come, for responding a new thread is
started, etc.
To listen new socket connections, and socket events, a single
thread is used (Call this event listener thread).
Everything works perfectly. Firefox
On 02/04/16 18:53, ixid via Digitalmars-d-learn wrote:
> On Thursday, 4 February 2016 at 17:34:33 UTC, Artur Skawina wrote:
>> On 02/04/16 16:32, Artur Skawina wrote:
>> but that seems too expensive, when the use is just in toy programs and
>> debugging.
>
> I hadn't really considered the relativ
Am Mon, 01 Feb 2016 02:56:06 +
schrieb Tofu Ninja :
> Just out of curiosity, does anyone have an octree implementation
> for D laying around? Just looking to save some time.
I have one written in Delphi that you could prune till it fits.
--
Marco
On Thursday, 4 February 2016 at 17:34:33 UTC, Artur Skawina wrote:
On 02/04/16 16:32, Artur Skawina wrote:
but that seems too expensive, when the use is just in toy
programs and debugging.
I hadn't really considered the relative cost-benefit, it's just a
habit to try to hardcode things at com
https://issues.dlang.org/show_bug.cgi?id=15645
Am Thu, 04 Feb 2016 15:17:54 +
schrieb Saurabh Das :
> On Thursday, 4 February 2016 at 12:28:39 UTC, Saurabh Das wrote:
> > This code:
> > [...]
>
> Update: Simplified, this also doesn't work:
>
> void main()
> {
> import std.typecons;
> auto tp = tuple(10, false, "hello");
>
>
On 02/04/16 16:32, Artur Skawina wrote:
>
>void print(A...)(A a) {
> foreach (N, ref e; a)
> write(e, N==A.length-1?"\n":" ");
>}
BTW, that was *deliberately* written that way as a compromise
between efficiency and template bloat. It can of course be
done like
void prin
On Thursday, 4 February 2016 at 15:10:18 UTC, Kagamin wrote:
On Thursday, 4 February 2016 at 14:25:21 UTC, bachmeier wrote:
Unfortunately there is no such thing and it is unlikely to
exist in the next decade.
There is
http://forum.dlang.org/post/mtsd38$16ub$1...@digitalmars.com
The importan
On Thursday, 4 February 2016 at 00:23:07 UTC, ixid wrote:
It would be nice to have a simple writeln that adds spaces
automatically like Python's 'print' in std.stdio, perhaps
called print.
It seems Andrei decided to add such function:
http://forum.dlang.org/thread/n8vr0l$ist$1...@digitalmars.
On 02/04/16 15:02, ixid via Digitalmars-d-learn wrote:
> On Thursday, 4 February 2016 at 13:46:46 UTC, Dejan Lekic wrote:
>> On Thursday, 4 February 2016 at 00:23:07 UTC, ixid wrote:
>>> It would be nice to have a simple writeln that adds spaces automatically
>>> like Python's 'print' in std.stdio
On Thursday, 28 January 2016 at 14:45:36 UTC, Adam D. Ruppe wrote:
On Thursday, 28 January 2016 at 14:39:46 UTC, sigod wrote:
I tried to compile your code on dpaste (2.070.0) and got this:
dpaste has an input mangling bug with some characters as a
result of the form submission over the web.
On Thursday, 4 February 2016 at 12:28:39 UTC, Saurabh Das wrote:
This code:
[...]
Update: Simplified, this also doesn't work:
void main()
{
import std.typecons;
auto tp = tuple(10, false, "hello");
auto u0 = tp.slice!(0, tp.length);
auto u1 = tp.slice!(1, tp.length);
auto
On Thursday, 4 February 2016 at 14:25:21 UTC, bachmeier wrote:
Unfortunately there is no such thing and it is unlikely to
exist in the next decade.
There is http://forum.dlang.org/post/mtsd38$16ub$1...@digitalmars.com
On Thursday, 4 February 2016 at 11:04:15 UTC, Ola Fosheim Grøstad
wrote:
On Thursday, 4 February 2016 at 10:59:50 UTC, Mike Parker wrote:
IMO, while giving beginner's a helping hand is a great thing,
I don't think it's a good basis to use as a design for a
standard library.
Yes, better to hav
On Thursday, 4 February 2016 at 13:46:46 UTC, Dejan Lekic wrote:
On Thursday, 4 February 2016 at 00:23:07 UTC, ixid wrote:
It would be nice to have a simple writeln that adds spaces
automatically like Python's 'print' in std.stdio, perhaps
called print.
There are many implementations of strin
On Thursday, 4 February 2016 at 00:23:07 UTC, ixid wrote:
It would be nice to have a simple writeln that adds spaces
automatically like Python's 'print' in std.stdio, perhaps
called print.
There are many implementations of string interpolation in D (that
is what you want, basically). One of t
On Wednesday, 3 February 2016 at 22:45:03 UTC, sigod wrote:
On Wednesday, 3 February 2016 at 22:27:07 UTC, holo wrote:
When i start same program on server in different timezone
difference is much higher (more than hour). Why it is
happening? Timezones shouldnt have influence on such equation.
This code:
void main()
{
import std.typecons;
auto tp = tuple!("a", "b", "c")(10, false, "hello");
auto u0 = tp.slice!(0, tp.length);
auto u1 = tp.slice!(1, tp.length);
auto u2 = tp.slice!(2, tp.length);
static assert(is(typeof(u0) == Tuple!(int, "a", bool, "b",
string,
On Thursday, 4 February 2016 at 11:04:23 UTC, cym13 wrote:
On Thursday, 4 February 2016 at 10:18:35 UTC, ixid wrote:
Do you think your knowledge and experience is a good model for
how a new user who hasn't done much if any programming before
would approach this?
A design choice had to be made
On Thursday, 4 February 2016 at 10:59:50 UTC, Mike Parker wrote:
IMO, while giving beginner's a helping hand is a great thing, I
don't think it's a good basis to use as a design for a standard
library.
Yes, better to have a "beginners toolkit" starting-point-codebase
and build a tutorial arou
On Thursday, 4 February 2016 at 10:18:35 UTC, ixid wrote:
Do you think your knowledge and experience is a good model for
how a new user who hasn't done much if any programming before
would approach this?
A design choice had to be made and made it was. Adding another
function now (or worse, ch
On Thursday, 4 February 2016 at 10:18:35 UTC, ixid wrote:
On Thursday, 4 February 2016 at 10:05:15 UTC, Jonathan M Davis
wrote:
I would normally expect someone to do that with writefln,
which would be cleaner. e.g.
writefln("%s %s %s %s", a, b, c, d);
Personally, I've never felt the need for
On Thursday, 4 February 2016 at 10:03:13 UTC, Jonathan M Davis
wrote:
On Wednesday, February 03, 2016 23:55:42 Ali Çehreli via
Digitalmars-d-learn wrote:
std::uncaught_exception used to be considered useless:
I think that the only case I've ever had for it was for a unit
testing framework whe
On Thursday, 4 February 2016 at 10:05:15 UTC, Jonathan M Davis
wrote:
I would normally expect someone to do that with writefln, which
would be cleaner. e.g.
writefln("%s %s %s %s", a, b, c, d);
Personally, I've never felt the need for a function like you're
describing.
- Jonathan M Davis
On Thursday, February 04, 2016 00:40:55 ixid via Digitalmars-d-learn wrote:
> On Thursday, 4 February 2016 at 00:30:03 UTC, cym13 wrote:
> > On Thursday, 4 February 2016 at 00:23:07 UTC, ixid wrote:
> >> It would be nice to have a simple writeln that adds spaces
> >> automatically like Python's 'pr
On Thursday, 4 February 2016 at 06:40:15 UTC, sanjayss wrote:
Are the functions lastSocketError() and wouldHaveBlocked() from
std.socket thread-safe? i.e. can they be reliably used to see
the status of the last socket call when sockets are being
read/written in multiple threads?
Not directly
On Wednesday, February 03, 2016 23:55:42 Ali Çehreli via Digitalmars-d-learn
wrote:
> std::uncaught_exception used to be considered useless:
I think that the only case I've ever had for it was for a unit testing
framework where I wanted to use RAII to print something when the tests
failed (and th
On Thursday, 4 February 2016 at 05:51:22 UTC, Enjoys Math wrote:
Consider:
class C {
}
class B : C {
}
class A : B {
}
class D : C {
}
C[] objList;
how do we test if objLis[k] is of base type "B"?
Ie for [new A(), new B(), new D(), new C()] would give output
[true, true, false, false]
On Thursday, 4 February 2016 at 07:11:44 UTC, xtreak wrote:
On Thursday, 4 February 2016 at 05:50:05 UTC, tsbockman wrote:
See my PR for a workaround:
https://github.com/D-Programming-Language/phobos/pull/3969/files
Thanks a lot for the patch. It will be helpful if you could
explain the worka
On Wednesday, 3 February 2016 at 21:35:38 UTC, Jonathan M Davis
wrote:
https://issues.dlang.org
At least that way, it's kept track of, though I certainly have
no idea when it might be implemented (presumably when someone
needs it enough that they take the time to do so).
Thanks, I think I wi
On Thursday, 4 February 2016 at 07:55:42 UTC, Ali Çehreli wrote:
std::uncaught_exception used to be considered useless:
http://www.gotw.ca/gotw/047.htm
Does that apply to D?
I've read that one, but Herb Sutter does not provide an argument,
just a claim that having different semantics on th
On 2016-02-03 13:29:15 +, anonymous said:
Still missing "class". I know I'm being pedantic, but if you're being
sloppy here, how do I know that you're not being sloppy where it
matters?
You are right, sorry. I was to focused on the problem part...
If anything, you should be casting bet
On 2016-02-03 14:35:16 +, Steven Schveighoffer said:
On 2/3/16 8:17 AM, Robert M. Münch wrote:
On 2016-02-02 18:59:35 +, Steven Schveighoffer said:
If this is valid D, I'm not sure what it means :)
There was one type, the rest I stripped totally away as IMO it's not
relevant for the
On 02/03/2016 03:47 AM, Ola Fosheim Grøstad wrote:
On Wednesday, 3 February 2016 at 11:41:28 UTC, Jonathan M Davis wrote:
AFAIK, there is no way to detect whether an exception is in flight or
not aside from the cases where scope(failure) or catch would catch the
exception, and from what I recall
52 matches
Mail list logo