Le Wed, 10 Dec 2008 03:16:49 +0100, Denis Koroskin <[EMAIL PROTECTED]> a
écrit:
On Wed, 10 Dec 2008 03:24:48 +0300, Jarrett Billingsley
<[EMAIL PROTECTED]> wrote:
On Tue, Dec 9, 2008 at 7:00 PM, BCS <[EMAIL PROTECTED]> wrote:
class C
{
final void add(T...)(T t)
{
foreach(int i,_
On Tue, Dec 9, 2008 at 11:54 PM, Ellery Newcomer
<[EMAIL PROTECTED]> wrote:
> Does the following totally not make sense? I think it should work.
>
> int[] a = new int[10];
>
> a.length += 30;
>
It's a weird limitation that's been around forever. Ugh.
Here, have this.
T[] resize(T)(ref T[] arr,
Does the following totally not make sense? I think it should work.
int[] a = new int[10];
a.length += 30;
raymond wrote:
how to check if array key exist in array or not? for example
char[] [char[]] t;
t["tes1"]="val1";
t["tes2"]="val2";
t["tes3"]="val3";
if (t["test1"]) writefln("NONE");
if("test1" in t) writefln("exists");
how to check if array key exist in array or not? for example
char[] [char[]] t;
t["tes1"]="val1";
t["tes2"]="val2";
t["tes3"]="val3";
if (t["test1"]) writefln("NONE");
Steven Schveighoffer:
> One thing you can do, that nobody has mentioned yet, is delete memory that
> you have allocated using the GC.
Leaving the GC manage and free your memory is usually OK. Managing manually
your memory allocated from the C heap is doable. But freeing manually and
forcefully
On Wed, 10 Dec 2008 03:24:48 +0300, Jarrett Billingsley <[EMAIL PROTECTED]>
wrote:
On Tue, Dec 9, 2008 at 7:00 PM, BCS <[EMAIL PROTECTED]> wrote:
class C
{
final void add(T...)(T t)
{
foreach(int i,_;T)
_add(t[i]);
}
//.
}
(new C).add(something, otherthings, thisT
On Tue, Dec 9, 2008 at 7:00 PM, BCS <[EMAIL PROTECTED]> wrote:
> class C
> {
> final void add(T...)(T t)
> {
> foreach(int i,_;T)
> _add(t[i]);
> }
> //.
> }
>
>
> (new C).add(something, otherthings, thisToo);
If all the params are the same type, typesafe variadics are
Reply to TSalm,
Hello,
How to implement an object that can do this :
myClass.add(something)(otherthings)(thisToo);
Is it possible ?
TIA,
TSalm
if you don't mind dropping the )(
class C
{
final void add(T...)(T t)
{
foreach(int i,_;T)
_add(t[i]);
}
//.
}
On Wed, 10 Dec 2008 02:40:47 +0300, tsalm <[EMAIL PROTECTED]> wrote:
Hello,
How to implement an object that can do this :
myClass.add(something)(otherthings)(thisToo);
Is it possible ?
TIA,
TSalm
Yes:
import std.stdio;
class MyClass
{
class MyClassAdder
{
MyClassAdder opCall(
tsalm wrote:
Hello,
How to implement an object that can do this :
myClass.add(something)(otherthings)(thisToo);
Is it possible ?
TIA,
TSalm
Something like this might work:
class MyClass{
int[] stuff;
alias add opCall;
MyClass add(int k){
stuff ~= k;
return this;
}
}
Hello,
How to implement an object that can do this :
myClass.add(something)(otherthings)(thisToo);
Is it possible ?
TIA,
TSalm
Daniel White wrote:
That would be a bad idea. Then how would you do manual memory
management in the few cases that absolutely require it?
Two ways. Either:
a: being able to lock the variable so that the garbage collector
can't touch it until you unlock it.
If you have a reference to the mem
Reply to llee,
I'm trying derive a class from a nested base class. The programs'
structure is as follows:
class A
{
class B
{
}
}
class C : A
{
class D : B
{
}
}
I'm using version 2.014 of the dmd compiler, and the above fails. The
compiler error reports that B is nested in class A and not C. D
On Tue, Dec 9, 2008 at 2:53 PM, Daniel White <[EMAIL PROTECTED]> wrote:
> Jarrett Billingsley Wrote:
>
>> On Tue, Dec 9, 2008 at 11:08 AM, Daniel White <[EMAIL PROTECTED]> wrote:
>> >> That would be a bad idea. Then how would you do manual memory
>> >> management in the few cases that absolutely r
On Tue, Dec 9, 2008 at 2:08 PM, llee <[EMAIL PROTECTED]> wrote:
> I'm trying derive a class from a nested base class. The programs' structure
> is as follows:
>
> class A
> {
> class B
> {
> }
> }
>
> class C : A
> {
> class D : B
> {
> }
> }
>
> I'm using version 2.014 of
Jarrett Billingsley Wrote:
> On Tue, Dec 9, 2008 at 11:08 AM, Daniel White <[EMAIL PROTECTED]> wrote:
> >> That would be a bad idea. Then how would you do manual memory
> >> management in the few cases that absolutely require it?
> >
> > Two ways. Either:
> >
> > a: being able to lock the variabl
I'm trying derive a class from a nested base class. The programs' structure is
as follows:
class A
{
class B
{
}
}
class C : A
{
class D : B
{
}
}
I'm using version 2.014 of the dmd compiler, and the above fails. The compiler
error reports that B is nested in clas
"Jarrett Billingsley" wrote
> It can obviously be argued that since the operands of ?: are constant,
> the compiler _could_ figure out that they should be of type wchar[],
> but that would make the semantic analysis more complicated, and since
> appending 'w' to the strings is far easier, it probab
Jarrett Billingsley wrote:
On Tue, Dec 9, 2008 at 12:00 PM, Ellery Newcomer
<[EMAIL PROTECTED]> wrote:
Derek Parnell wrote:
> It is not a bug. A string literal such as "true" is a char[] type (UTF8),
and the compiler will not implicitly convert UTF8 to UTF16 (wchar[]).
Which would then beg th
On Tue, Dec 9, 2008 at 12:00 PM, Ellery Newcomer
<[EMAIL PROTECTED]> wrote:
> Derek Parnell wrote:
> > It is not a bug. A string literal such as "true" is a char[] type (UTF8),
>>
>> and the compiler will not implicitly convert UTF8 to UTF16 (wchar[]).
>
> Which would then beg the obvious
>
> wcha
On Tue, Dec 9, 2008 at 11:08 AM, Daniel White <[EMAIL PROTECTED]> wrote:
>> That would be a bad idea. Then how would you do manual memory
>> management in the few cases that absolutely require it?
>
> Two ways. Either:
>
> a: being able to lock the variable so that the garbage collector
> can't to
Lars Ivar Igesund wrote:
Tango 0.99.7 doesn't support DMD 1.037 - either use DMD 1.033 or check out
Tango trunk.
Say what you will, I got it to work :)
I also experienced the crash on 1.030, 1.033, and 1.035 variously on
linux and windows, so 1.037 was just to see if it had been fixed by
Derek Parnell wrote:
> It is not a bug. A string literal such as "true" is a char[] type
(UTF8),
and the compiler will not implicitly convert UTF8 to UTF16 (wchar[]).
Which would then beg the obvious
wchar[] w = "true";
torhu wrote:
You can't use module constructors (static this) in modules that import
each other.
So THAT'S why I couldn't replicate it :)
> That would be a bad idea. Then how would you do manual memory
> management in the few cases that absolutely require it?
Two ways. Either:
a: being able to lock the variable so that the garbage collector
can't touch it until you unlock it.
b: Using a slightly different version of malloc (say '
On Tue, Dec 9, 2008 at 9:52 AM, Steven Schveighoffer
<[EMAIL PROTECTED]> wrote:
> I'm not sure about this problem. I've not encountered it, but it sounds
> weird that it would cause a runtime error...
It is weird.
[a.d]
module a;
import b;
static this(){}
void main(){}
[b.d]
mod
On Tue, Dec 9, 2008 at 9:42 AM, Jarrett Billingsley
<[EMAIL PROTECTED]> wrote:
> On Tue, Dec 9, 2008 at 9:16 AM, Daniel White <[EMAIL PROTECTED]> wrote:
>> Thanks for that reply. I wonder if extending automatic garbage
>> collection for malloced memory would be a good idea...
>
> That would be a ba
On Tue, Dec 9, 2008 at 9:16 AM, Daniel White <[EMAIL PROTECTED]> wrote:
> Thanks for that reply. I wonder if extending automatic garbage
> collection for malloced memory would be a good idea...
That would be a bad idea. Then how would you do manual memory
management in the few cases that absolute
"Daniel White" wrote
> Thanks for that reply. I wonder if extending automatic garbage
> collection for malloced memory would be a good idea...
>
>> Only stuff like dynamic
>> arrays, AAs and new'ed stuff gets cleaned up by the GC.
>
> For the above types of allocating memory, is there a way to 'loc
"Ellery Newcomer" wrote
> Hello all,
>
> I began learning D a few months ago, and now I have a question about
> cyclic dependencies (and some random whining).
>
> I come from a java background and have had no serious exposure to C++. In
> java, cyclic dependencies are legit to the best of my know
Thanks for that reply. I wonder if extending automatic garbage
collection for malloced memory would be a good idea...
> Only stuff like dynamic
> arrays, AAs and new'ed stuff gets cleaned up by the GC.
For the above types of allocating memory, is there a way to 'lock' a
variable and say to D, "d
Dan W:
> 1: Even though D has an automatic garbage collector, is one still
> allowed to free the memory of a malloced array manually (using free
> () ), to avoid pauses in the program?
Other people here will just answer your question. But remember that in D manual
memory management is done only i
BLS Wrote:
> John schrieb:
> > BCS Wrote:
> >
> >> Reply to John,
> >>
> >>> Hello!
> >>>
> >>> I'm wanting to use D to send a PDF to a printer. Is there an easy way
> >>> to do this? Also, I may need to set which tray to go to and whether it
> >>> should duplex or not.
> >>>
> >>> Could someone
On Tue, 09 Dec 2008 10:26:29 +0300, Ellery Newcomer <[EMAIL PROTECTED]> wrote:
Also, I would be trying to compile with DMD, but I have evidently
managed to crash the compiler, and I don't know if it's DMD's fault or
mine. It reports an Internal Error in e2ir.c at line 3904. (not being a
C++
The Anh Tran wrote:
static double[N] dd = void;
dd is not a compile-time constant.
static auto tmp = f!(N).fn(dd);
The initializer of tmp must be a compile-time constant, but since dd is
not a compile-time constant, you can't use CTFE on fn.
poly Wrote:
> asm
> {
> call Label1;
> Label1: pop ECX;
> mov EAX, Label1; //error reported on this line
> }
I tried several tricks, seems like compiler doesn't support this.
Ellery Newcomer wrote:
> Hello all,
>
> I began learning D a few months ago, and now I have a question about
> cyclic dependencies (and some random whining).
>
> I come from a java background and have had no serious exposure to C++.
> In java, cyclic dependencies are legit to the best of my know
Ellery Newcomer wrote:
When I first started learning D I decided that a good way to learn it
would be by porting a popular java api (mind, I didn't say intelligent),
which came complete with a few cyclic dependencies. At the moment, I'm
using GDC, and it refuses to swallow cyclic dependencies.
On Tue, 09 Dec 2008 01:26:29 -0600, Ellery Newcomer wrote:
>
> wchar[] w = (true)? "true":"false";
>
> --> Error: cannot implicitly convert expression ("true") of type char[]
> to wchar[]
>
> or should it be reported as a bug?
It is not a bug. A string literal such as "true" is a char[] type
Hi,
I would like to pre-create a double array, each element is calculated by
a function.
//-
import std.stdio;
import std.conv;
import std.string;
template f(int N)
{
bool fn(double[] tb)
{
for (int i = 1; i <
John schrieb:
BCS Wrote:
Reply to John,
Hello!
I'm wanting to use D to send a PDF to a printer. Is there an easy way
to do this? Also, I may need to set which tray to go to and whether it
should duplex or not.
Could someone help me out?
THANKS!
You would do it the same way that it would b
42 matches
Mail list logo