On Monday, 15 December 2014 at 07:41:40 UTC, drug wrote:
On 13.12.2014 23:26, Suliman wrote:
I reread docs and understood that scope not for such case.
Next code is do what I need:
try
{
string dbname = config.getKey(dbname);
string dbpass = config.getKey(dbpass);
string dbhost =
On 15.12.2014 12:22, Marc Schütz schue...@gmx.net wrote:
Unfortunately you don't have access to the exception object inside the
`scope(failure)` block.
Ah, yes, it has to be without msg.msg
scope(failure) writeln(Something is wrong);
On Sunday, 14 December 2014 at 23:16:12 UTC, Nordlöw wrote:
What's the fastest way to append multiple elements to an array?:
Either
arr ~= e1;
arr ~= e2;
arr ~= e3;
or
arr ~= [e1,e2,e3];
or some other trick?
It does somewhat depend on context but std.array.appender is
Is there a combined property of AAs that combine keys and values
typically
.pairs()
or
.byPairs()
I need to sort the elements of an AA by value and then retrieved
corresponding keys in the order sorted.
Nordlöw:
Is there a combined property of AAs that combine keys and
values typically
.pairs()
or
.byPairs()
I need to sort the elements of an AA by value and then
retrieved corresponding keys in the order sorted.
You can add an eager pairs() function to Phobos that returns an
array of
On Sunday, 14 December 2014 at 22:14:55 UTC, Ryan wrote:
I'm writing a Matrix struct that I plan to use for some number
crunching, which will be intensive at times. So I want it to be
fast.
Will I do better by manually managing the memory myself with
malloc and free in the
On 12/13/14 5:47 AM, Marc =?UTF-8?B?U2Now7x0eiI=?= schue...@gmx.net
wrote:
On Friday, 12 December 2014 at 19:35:26 UTC, Steven Schveighoffer wrote:
On 12/12/14 2:17 PM, H. S. Teoh via Digitalmars-d-learn wrote:
I've started working on an implementation of this... but it's not very
clear what
On 12/13/14 3:59 AM, Jeremy DeHaan wrote:
I'll be trying to narrow it down even more tomorrow, but I was hoping
somone here might have some insight into this weird issue I am having.
I have a dynamic array of shorts that I had been trying to append to
(capturing sound data). I kept getting a
On Monday, 15 December 2014 at 15:19:25 UTC, Steven Schveighoffer
wrote:
On 12/13/14 5:47 AM, Marc =?UTF-8?B?U2Now7x0eiI=?=
schue...@gmx.net wrote:
On Friday, 12 December 2014 at 19:35:26 UTC, Steven
Schveighoffer wrote:
On 12/12/14 2:17 PM, H. S. Teoh via Digitalmars-d-learn wrote:
I've
On 12/15/14 10:24 AM, Steven Schveighoffer wrote:
A guess -- is the class instantiated in C++? if so, it probably is not
on the D heap, and probably is not scanned during GC collections. I
think your m_samples array is reallocated during a collection, and you
are using dangling memory.
Try
On 12/13/14 2:03 AM, Andrey Derzhavin wrote:
Hello!
We have object, for example, objA.
ObjectAType objA = new ObjectAType(...);
// we have a many references to objA
void someFunction1(...)
{
// destroying the objA
destroy(one_of_the_refToObjA);
//
}
void
On 12/14/14 6:16 PM, Nordlöw wrote:
What's the fastest way to append multiple elements to an array?:
Before appending, call reserve to avoid the possibility of reallocating
multiple times:
arr.reserve(arr.length + n); // about to append n elements.
Either
arr ~= e1;
arr ~= e2;
You can add an eager pairs() function to Phobos that returns an
array of tuples.
byPairs can't be done in object.d for the dependency from
tuples that aren't yet (and perhaps never) built-in in D, and
it can't be done in Phobos because it needs access to
unspecified runtime functions.
I'm pretty sure my problem isn't my code but how I've built the
lib. The problem is I'm calling external C code and I am getting
valid data out of it but /some/ of my arguments to it is
corrupted.
A common thread in this newsgroup seems to be people calling
Extern(Windows). I don't that is me
On Mon, 15 Dec 2014 17:37:13 +
Tobias Pankrath via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com wrote:
I think we should require byKeys and byValues to iterate the
elements in the same order. Than we can just zip them for the
pairwise iteration.
Would this impose a
On Monday, 15 December 2014 at 17:48:32 UTC, AuoroP via
Digitalmars-d-learn wrote:
ulong jpegSize,
Without looking too closely, this sets off an alarm to me: C's
long and D's long are not really compatible because C's long has
variable size and D's long is 64 bit.
I'd say try import
On 12/15/14 12:52 PM, ketmar via Digitalmars-d-learn wrote:
On Mon, 15 Dec 2014 17:37:13 +
Tobias Pankrath via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com wrote:
I think we should require byKeys and byValues to iterate the
elements in the same order. Than we can just zip them for
On Mon, Dec 15, 2014 at 02:27:52PM +, Nordlöw via Digitalmars-d-learn
wrote:
Is there a combined property of AAs that combine keys and values
typically
.pairs()
or
.byPairs()
I need to sort the elements of an AA by value and then retrieved
corresponding keys in the order
On Mon, 15 Dec 2014 13:01:10 -0500
Steven Schveighoffer via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com wrote:
but i agree that this
requirement should be documented. and i bet it will not, 'cause this
will support principle of least astonishment, which is completely alien
for
ketmar:
the only way to get it into the specs is to write the useful
library that relies on that behavior and then scream don't
break our code, it's regression! then it eventually may be
turned to requirement and documented.
This is a bad idea.
Bye,
bearophile
H. S. Teoh:
I implemented this before, but it got rejected because people
insisted
that it must return a range of Tuple, but Tuple is defined in
Phobos and
druntime can't have dependencies on Phobos. :-(
Maybe I'll take another shot at this, since this question keeps
coming up.
One
On 12/15/14 1:10 PM, ketmar via Digitalmars-d-learn wrote:
On Mon, 15 Dec 2014 13:01:10 -0500
Steven Schveighoffer via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com wrote:
but i agree that this
requirement should be documented. and i bet it will not, 'cause this
will support principle
On Mon, 15 Dec 2014 13:47:58 -0500
Steven Schveighoffer via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com wrote:
On 12/15/14 1:10 PM, ketmar via Digitalmars-d-learn wrote:
On Mon, 15 Dec 2014 13:01:10 -0500
Steven Schveighoffer via Digitalmars-d-learn
Now this yields tuples:
assert(aa.byPair!Tuple.array == aa.pairs!Tuple);
But I'd really like tuples as built-ins for D -.- This is a
work-around that cements the ugly Phobos tuples in the
language... -.-
Bye,
bearophile
On Mon, Dec 15, 2014 at 06:46:20PM +, bearophile via Digitalmars-d-learn
wrote:
H. S. Teoh:
I implemented this before, but it got rejected because people
insisted that it must return a range of Tuple, but Tuple is defined
in Phobos and druntime can't have dependencies on Phobos. :-(
Thank you very much, Steven!
On Monday, 15 December 2014 at 15:55:22 UTC, Steven Schveighoffer
wrote:
What's the fastest way to append multiple elements to an
array?:
Before appending, call reserve to avoid the possibility of
reallocating multiple times:
arr.reserve(arr.length + n); // about to append n elements.
On Monday, 15 December 2014 at 18:55:13 UTC, bearophile wrote:
Now this yields tuples:
assert(aa.byPair!Tuple.array == aa.pairs!Tuple);
But I'd really like tuples as built-ins for D -.- This is a
work-around that cements the ugly Phobos tuples in the
language... -.-
Bye,
bearophile
Kenji
On Mon, 15 Dec 2014 21:32:23 +
Meta via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote:
On Monday, 15 December 2014 at 18:55:13 UTC, bearophile wrote:
Now this yields tuples:
assert(aa.byPair!Tuple.array == aa.pairs!Tuple);
But I'd really like tuples as built-ins for D
Given the following program:
import std.string;
import std.stdio;
void main()
{
File file = File(blah.txt, r);
while( !(file.eof()) count 10 ) { //line 8
//
}
}
I get the error message:
line(8): Error: void has no value
If I comment
CraigDillabaugh:
Given the following program:
import std.string;
import std.stdio;
void main()
{
File file = File(blah.txt, r);
while( !(file.eof()) count 10 ) { //line 8
//
}
}
I get the error message:
line(8): Error: void has no
On Mon, 15 Dec 2014 22:09:28 +
CraigDillabaugh via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com wrote:
Given the following program:
import std.string;
import std.stdio;
void main()
{
File file = File(blah.txt, r);
while( !(file.eof()) count 10 )
On Monday, 15 December 2014 at 14:41:43 UTC, bearophile wrote:
Nordlöw:
Is there a combined property of AAs that combine keys and
values typically
.pairs()
or
.byPairs()
I need to sort the elements of an AA by value and then
retrieved corresponding keys in the order sorted.
You can add
On Monday, 15 December 2014 at 22:58:43 UTC, Nordlöw wrote:
Tuple!(Key,Value)[] pairs(Key,Value)(Value[Key] aa);
a suitable contender for now?
I especially wonder about the mutability of parameter aa.
More specifically is
https://github.com/nordlow/justd/blob/master/range_ex.d#L545
ok?
Could someone please explain why the following doesn't compile
with const qualifier while it does work without it?
/* test.d */
module test;
mixin template Foo() {
mixin(@property int bar() const { return foo; });
}
int foo = 1;
mixin Foo;
unittest {
assert(foo == bar);
}
rdmd
On Monday, 15 December 2014 at 23:14:30 UTC, aldanor wrote:
Could someone please explain why the following doesn't compile
with const qualifier while it does work without it?
/* test.d */
module test;
mixin template Foo() {
mixin(@property int bar() const { return foo; });
}
int foo =
Thank you!!!
All I have to do is
-Original Message-
From: digitalmars-d-learn@puremagic.com
Sent: Mon, 15 Dec 2014 17:54:51 +
To: digitalmars-d-learn@puremagic.com
Subject: Re: Problem calling extern(C) function
On Monday, 15 December 2014 at 17:48:32 UTC, AuoroP via
package com.kerisy.mod.base
interface BaseMod
{
auto getInstance();
}
package com.kerisy.mod.a
class A : BaseMod
{
A getInstance()
{
return (new A);
}
void hello()
{
// in A
writeln(in A);
On Tuesday, 16 December 2014 at 04:45:31 UTC, Brian wrote:
interface BaseMod
{
auto getInstance();
}
You can't do that - interface methods must be either final or
have concrete types (they can't be templates or auto returns).
Make it BaseMod getInstance(); and the rest of your
If I have a thread that I need to detach from druntime, I can call
thread_detachInstance, but for 2.066, this function does not exist. Is
there any way to do this in 2.066? I notice there is a
thread_detachByAddr, but I'm not sure how to get a ThreadAddr out of a
Thread..
40 matches
Mail list logo