> useo:
> > Is there anything I forgot to consider?
> If the key and values are primitive values or structs of primitive
values then you may try another AA implementation that doesn't use
the GC.
> Bye,
> bearophile
I tried some different implementations and I also reduced the size of
my arrays wi
On 2011-06-12 22:37, Jonathan M Davis wrote:
> On 2011-06-12 22:25, Lloyd Dupont wrote:
> > I have problem with "Object"
> >
> > for example this doesn't compile:
> > ===
> > Object o;
> > o = "";
> > ===
> > with error: cannot implicitly convert expression ("") of type string to
> > object.Object
On 2011-06-12 22:25, Lloyd Dupont wrote:
> I have problem with "Object"
>
> for example this doesn't compile:
> ===
> Object o;
> o = "";
> ===
> with error: cannot implicitly convert expression ("") of type string to
> object.Object
Object is the base class of all classes. Nothing which is not a
I have problem with "Object"
for example this doesn't compile:
===
Object o;
o = "";
===
with error: cannot implicitly convert expression ("") of type string to
object.Object
or this also failed to compile:
===
class Foo
{
public:
Object foo, bar, snafu;
override const bool opEquals(Obj
Thanks Steven, that was very informative!
"Steven Schveighoffer" wrote in message
news:op.vwzrwdmteav7ka@localhost.localdomain...
On Sun, 12 Jun 2011 21:02:05 -0400, Lloyd Dupont
wrote:
But... string being immutable I don't see the point of allocating some
space for one..
Am I missing som
On Sun, 12 Jun 2011 21:02:05 -0400, Lloyd Dupont
wrote:
But... string being immutable I don't see the point of allocating some
space for one..
Am I missing something?
Reserving space for appending does not make that space immutable, yet.
As far as the runtime is concerned, that space is
On 2011-06-12 18:02, Lloyd Dupont wrote:
> But... string being immutable I don't see the point of allocating some
> space for one..
> Am I missing something?
Just because it's immutable doesn't mean that it doesn't need to exist at
runtime. All immutable means is that you can't change it. It coul
Thanks!
"Jonathan M Davis" wrote in message
news:mailman.851.1307909610.14074.digitalmars-d-
Also, std.string.repeat has been scheduled for deprecation. You should use
std.array.replicate instead. It does the same thing but for all arrays
instead
of just strings.
- Jonathan M Davis
I've got 2.053 and it works for me.
But... string being immutable I don't see the point of allocating some space
for one..
Am I missing something?
"Steven Schveighoffer" wrote in message
news:op.vwy503w4eav7ka@localhost.localdomain...
On Sun, 12 Jun 2011 12:49:25 -0400, Lloyd Dupont
wrote:
I have a method like that:
===
pub
yep, the example is simple because it is an example!
Thanks for your suggestion! :)
"Jonathan M Davis" wrote in message
news:mailman.850.1307909499.14074.digitalmars-d-le...@puremagic.com...
On 2011-06-12 10:30, David Nadlinger wrote:
On 6/12/11 6:37 PM, Lloyd Dupont wrote:
> mm... ok.
> but
do you have DMD 2.053 on Windows?
Your code fail for me with:
main.d(10): Error: Integer constant expression expected instead of "hello"
main.d(11): Error: Integer constant expression expected instead of "betty"
main.d(10): Error: Integer constant expression expected instead of "hello"
main.d
Lloyd Dupont wrote:
> I'm using 2.053
> this compile fine:
>
> enum : string
> {
> A = "hello",
> B = "betty",
> }
>
>
> this doesn't!
>
> enum AA : string
> {
> A = "hello",
> B = "betty",
> }
>
>
> Am I missing something? Named enum can't be typed? known bug?
Den 12-06-2011 18:37, Lloyd Dupont skrev:
mm... ok.
but why the line below doesn't compile?
mixin(format("class %s {}", "A"));
Because the mixin is evaluated at compile time. This means that
format(...) is evaluated at compile time which afaik is not supported.
It may be supported in the fu
Den 12-06-2011 15:43, Lloyd Dupont skrev:
From the book I was under the impression that there could be user
defined attribute.
I wonder if this has been implemented?
My problem: I try to implement a simplistic "DataContractSerializer" (as in
http://msdn.microsoft.com/en-us/library/SYSTEM.RUNTIM
On 2011-06-12 11:08, Steven Schveighoffer wrote:
> On Sun, 12 Jun 2011 12:49:25 -0400, Lloyd Dupont
>
> wrote:
> > I have a method like that:
> > ===
> > public string repeat(string s, int num)
> > {
> >
> > string result = s;
> > for (int i=1; i >
> > result ~= s;
> >
On 2011-06-12 10:30, David Nadlinger wrote:
> On 6/12/11 6:37 PM, Lloyd Dupont wrote:
> > mm... ok.
> > but why the line below doesn't compile?
> >
> > mixin(format("class %s {}", "A"));
>
> Because format presumably can't be interpreted at compile time (yet) –
> not all functions are necessarily
Jonathan M Davis wrote:
On 2011-06-12 02:37, bearophile wrote:
Jonathan M Davis:
Certainly, once range propagation has been fully implemented, this
particular will work without needing any casts, but as soon as the
compiler doesn't know what the values of x and y are, I believe that it
would st
On Sun, 12 Jun 2011 12:49:25 -0400, Lloyd Dupont
wrote:
I have a method like that:
===
public string repeat(string s, int num)
{
string result = s;
for (int i=1; i
The runtime tries its best to avoid allocating a new string on each
append. Please read the manual on appending, and
On 6/12/11 6:37 PM, Lloyd Dupont wrote:
mm... ok.
but why the line below doesn't compile?
mixin(format("class %s {}", "A"));
Because format presumably can't be interpreted at compile time (yet) –
not all functions are necessarily CTFEable.
David
I have a method like that:
===
public string repeat(string s, int num)
{
string result = s;
for (int i=1; i
I'm using 2.053
this compile fine:
enum : string
{
A = "hello",
B = "betty",
}
this doesn't!
enum AA : string
{
A = "hello",
B = "betty",
}
Am I missing something? Named enum can't be typed? known bug?
mm... ok.
but why the line below doesn't compile?
mixin(format("class %s {}", "A"));
"bearophile" wrote in message news:it2pf5$1qh6$1...@digitalmars.com...
Apparently std.string.format() is not implemented / does not compile! :(
This works for me, DMD 2.053:
Lloyd Dupon:
> Apparently std.string.format() is not implemented / does not compile! :(
This works for me, DMD 2.053:
import std.stdio, std.string;
void main() {
int x = 10;
auto s = format("%d", 10);
writeln(">", s, "<");
}
Bye,
bearophile
Apparently std.string.format() is not implemented / does not compile! :(
Is there any sort of replacement?
Something which works like writefln() but output a string!
From the book I was under the impression that there could be user defined
attribute.
I wonder if this has been implemented?
My problem: I try to implement a simplistic "DataContractSerializer" (as in
http://msdn.microsoft.com/en-us/library/SYSTEM.RUNTIME.SERIALIZATION.DATACONTRACTSERIALIZER(v=vs
On 2011-06-12 02:37, bearophile wrote:
> Jonathan M Davis:
> > Certainly, once range propagation has been fully implemented, this
> > particular will work without needing any casts, but as soon as the
> > compiler doesn't know what the values of x and y are, I believe that it
> > would still end up
Jonathan M Davis:
> Certainly, once range propagation has been fully implemented, this particular
> will work without needing any casts, but as soon as the compiler doesn't know
> what the values of x and y are, I believe that it would still end up
> complaining.
I am not sure D range propagat
Jonathan M Davis:
> That would depend entirely on the optimizer.
You have to take a look at the asm produced by the compiler to be sure what its
optimizations have done.
Bye,
bearophile
Do you know if in Phobos there is already a way to format a number with
thousands separators (a point, comma o underscore)?
Bye and thank you,
bearophile
30 matches
Mail list logo