On Mon, 18 Feb 2013 22:45:29 -0500, Nick Sabalausky
wrote:
On Mon, 18 Feb 2013 22:30:48 -0500
"Steven Schveighoffer" wrote:
Hm.. wouldn't plain goto work:
> final switch(foo)
> {
> case Foo.a:
> final switch(bar)
> {
> case Bar.bar:
> goto HORRIBLE_HACK;
> brea
On Mon, 18 Feb 2013 22:30:48 -0500
"Steven Schveighoffer" wrote:
>
> Hm.. wouldn't plain goto work:
>
> > final switch(foo)
> > {
> > case Foo.a:
> > final switch(bar)
> > {
> > case Bar.bar:
> > goto HORRIBLE_HACK;
> > break;
> > }
> > break;
> >
> > case Foo
On Mon, 18 Feb 2013 20:59:37 -0500, Nick Sabalausky
wrote:
Consider these nested switches:
---
enum Foo {a, b}
enum Bar {bar}
auto foo = Foo.a;
auto bar = Bar.bar;
final switch(foo)
{
case Foo.a:
final switch(bar)
{
case Bar.bar:
XX
b
On Tuesday, 19 February 2013 at 01:09:06 UTC, Ali Çehreli wrote:
[...]
How about an OO solution?
That looks awesome. :)
I'll have a play with it and see if I can bend it to my will.
Thanks for the help.
Like I said, I'm a bit of a noob, so a push in a more suitable
direction is always apprec
Consider these nested switches:
---
enum Foo {a, b}
enum Bar {bar}
auto foo = Foo.a;
auto bar = Bar.bar;
final switch(foo)
{
case Foo.a:
final switch(bar)
{
case Bar.bar:
XX
break;
}
break;
case Foo.b:
break;
}
On 02/18/2013 04:31 PM, Brian Brady wrote:
> So a program that reads in a csv of the form:
>
> "string, number, number, number"
>
> and stores it in a container/matrix/associative array
>
> could also read in
>
> "number, number, string, number, string, number, number, number"
>
> and store it in
On Monday, 18 February 2013 at 16:54:59 UTC, Ali Çehreli wrote:
[...]
You mean like this?
10,20,label,1,2,3,4
Then what are 10 and 20 on that line? Do they belong to the
previous label? If so, I think this format is too free-form to
be parsed by a general solution like csvReader. It looks li
Am Mon, 18 Feb 2013 10:07:45 +0100
schrieb Jacob Carlborg :
> Yeah, GetModuleFileNameW should be used. I'm pretty sure the other
> platforms will return UTF-8.
I also found that console output on Windows works best with
wchars.
Linux doesn't have any official support to get the module file
name,
On Monday, 18 February 2013 at 12:28:22 UTC, bearophile wrote:
[...]
Since some time I am maintaining most of the D code on
Rosettacode. What's broken in that program? "it doesn't work"
is too much vague.
Bye,
bearophile
Apologies. My wording was poor. I believe the RosettaCode code
worked
On 2/19/13, Steven Schveighoffer wrote:
> // don't need to redefine addAll
Ah, that sheds a big light on this feature actually, thanks.
I'm running into several issues, so first, is this supposed to
work correctly? I'm looking into D code DLLs called by D code.
On Mon, 18 Feb 2013 17:14:54 -0500, Andrej Mitrovic
wrote:
http://dlang.org/template.html#TemplateThisParameter
That's hardly a descriptive example, so in what context is the feature
useful? Some code snippets would be welcome so we can update the page
with a nicer and more useful example.
Yes, it's comes from C#.
So, there is no static for classes at module level. Good to have
a msg for it at compile-time.
import std.stdio;
public final abstract class Test
{
static this() { writeln("in static ctor"); }
static :
void foo() { writeln("in static method"); }
}
void
Am Wed, 02 May 2012 02:45:32 +0200
schrieb "bearophile" :
> I'd like to open an enhancement request for something like this
> as a feature for all D compilers, what do you think? (Generally
> Ada has something to teach to D design):
>
> http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gnat_ugn_unw/Stack
On 2013-02-18 17:13, Alexandr Druzhinin wrote:
and this the next problem I get - the application eats memory always. in
C++ I'd say it is leaks but with gc I'm not sure it is - I guess gc
collects memory but I don't see in reality. I think I don't understand
something important and now I read fr
Ahh. I fixed the project dependencies and this probably fixed linker
errors...
Dňa 18. 2. 2013 18:51 Lubos Pintes wrote / napísal(a):
you compiled(bild) the dgui lib yourself with 2.062?
i will not work if you use the prebuild ones
Yes. And as I said in some previous post, everything worked w
you compiled(bild) the dgui lib yourself with 2.062?
i will not work if you use the prebuild ones
Yes. And as I said in some previous post, everything worked with 2.060.
Quite confused.
Am 18.02.2013 18:37, schrieb Lubos Pintes:
Hi,
I already did this. I am playing with that library.
I converted it so that it uses win32 windows api bindings and fixed a
bunch of compile errors. I also converted enum names
"So_THEY_ARE_NOT_SO_UGLY". :-).
Everything worked fine with 2.060.
you co
Am 17.02.2013 23:25, schrieb Jonathan M Davis:
On Sunday, February 17, 2013 23:00:19 Michael wrote:
> That's not the meaning of static in that context.
As I understand a static class can't be instantiated.
I have no idea how you came to that conclusion. That's not what it means for a
class to
Hi,
I already did this. I am playing with that library.
I converted it so that it uses win32 windows api bindings and fixed a
bunch of compile errors. I also converted enum names
"So_THEY_ARE_NOT_SO_UGLY". :-).
Everything worked fine with 2.060. At least it compiled and sample were
running nice
On 02/18/2013 09:22 AM, Ali Çehreli wrote:
> static immutable GameInfo[string] games;
>
> static this()
> {
> games = [ "one" : GameInfo(1) ];
> }
And to be honest, I am not sure why I define it as 'static immutable'.
:) Isn't this the same thing?
immutable GameInfo[string] games;
static thi
On 2/17/13 7:25 PM, Jonathan M Davis wrote:
On Sunday, February 17, 2013 23:00:19 Michael wrote:
That's not the meaning of static in that context.
As I understand a static class can't be instantiated.
I have no idea how you came to that conclusion.
Probably because of this:
http://msdn.mi
Thank for explanation. I supposed that the enum constant is fixed and
that it is also true for AA.
I will convert my code before I forget. :-).
Dňa 18. 2. 2013 18:22 Ali Çehreli wrote / napísal(a):
On 02/18/2013 08:59 AM, Lubos Pintes wrote:
> Yesterday I solved similar problem by using enum.
On 02/18/2013 08:59 AM, Lubos Pintes wrote:
> Yesterday I solved similar problem by using enum.
> enum GameInfo[string] games=[
> ...
> ];
Be careful with that though: 'games' is a literal associative array,
meaning that it will be used in the program as if it's copy-pasted in
that location. It
On Monday, 18 February 2013 at 16:47:00 UTC, Lubos Pintes wrote:
I am playing with library dgui.
In 2.060, everything built fine.
One of library samples imports std.string. Perhaps the VisualD
doesn't include necessary library?
I updated the DMD as follows: I deleted the dmd2 from C:\D
folder a
Yesterday I solved similar problem by using enum.
enum GameInfo[string] games=[
...
];
Dňa 8. 2. 2013 21:21 anonymous wrote / napísal(a):
On Friday, 8 February 2013 at 20:12:41 UTC, Dan wrote:
This constant in a module causes a compilation error of the
"non-constant expression" variety.
DEFINI
On 02/18/2013 02:55 AM, Brian Brady wrote:
> On Monday, 18 February 2013 at 05:26:39 UTC, Ali Çehreli wrote:
>> What I see there is a label and a number of integers. Here is a simple
>> parser that takes advantage of the %( and %) grouping format specifiers:
>>
> Aye, in this instance it is just
I am playing with library dgui.
In 2.060, everything built fine.
One of library samples imports std.string. Perhaps the VisualD doesn't
include necessary library?
I updated the DMD as follows: I deleted the dmd2 from C:\D folder and
replaced it with one I downloaded from dlang.org. Is this nonst
On 02/18/2013 08:13 AM, Alexandr Druzhinin wrote:
18.02.2013 22:39, Jacob Carlborg пишет:
* The GC will never give back memory to the OS which it has allocated
and this the next problem I get - the application eats memory always. in
C++ I'd say it is leaks but with gc I'm not sure it is - I g
On Mon, Feb 18, 2013 at 11:13:25PM +0700, Alexandr Druzhinin wrote:
> 18.02.2013 22:39, Jacob Carlborg пишет:
> >
> >* The GC will never give back memory to the OS which it has allocated
[...]
Take a look at GC.minimize() here:
http://dlang.org/phobos/core_memory.html
Or does that not work at the
18.02.2013 22:39, Jacob Carlborg пишет:
* The GC will never give back memory to the OS which it has allocated
and this the next problem I get - the application eats memory always. in
C++ I'd say it is leaks but with gc I'm not sure it is - I guess gc
collects memory but I don't see in reality
On Monday, 18 February 2013 at 12:55:13 UTC, Lubos Pintes wrote:
Hi,
I just updated to DMD 2.062. I then tried to recompile somewhat
bigger project. After fixing some errors, I received dozens of
errors like this:
Error 42: Symbol Undefined _D3std6string6formatFYAya
(immutable(char)[] std.stri
On 2013-02-18 15:53, Alexandr Druzhinin wrote:
I agree. But hidden member can't occupy so much memory that I disturb so
much. I'm sure I use memory allocation in wrong manner but I haven't
glue so far.
Manual memory allocating is simpler for me than gc - I mean it's more
explicit.
Some things
On 02/18/2013 03:35 PM, Ivan Kazmenko wrote:
I wonder what is the use case of std.random.randomCover when one has
std.random.randomShuffle. I was trying to use it just to get a random
permutation of integers, and found randomCover prior to randomShuffle. However,
for the number of elements as l
18.02.2013 21:23, Jacob Carlborg пишет:
An object will contain some hidden members as well.
I agree. But hidden member can't occupy so much memory that I disturb so
much. I'm sure I use memory allocation in wrong manner but I haven't
glue so far.
Manual memory allocating is simpler for me than
1. Speed.
+randomShuffle performs O(n) steps and O(n) uniform() calls.
-randomCover performs O(n^2) steps and O(n^2) uniform() calls.
The latter however can (and perhaps should?) be optimized to
O(n): in the implementation, the line
Sorry, this part doesn't look clear. O(n^2) total with O(n^2
I'm unsure whether I should post into the ".learn" sub-forum or
some other one in such a case, but still.
I wonder what is the use case of std.random.randomCover when one
has std.random.randomShuffle. I was trying to use it just to get
a random permutation of integers, and found randomCover p
On 2013-02-18 13:43, Alexandr Druzhinin wrote:
Suddenly I detect that my application is using too much memory, so I
need some way to know how much memory is used by some object to improve
the app. How can I do it?
I've used some OS specific things but they aren't convenient because
provide inform
18.02.2013 20:54, bearophile пишет:
Alexandr Druzhinin:
so I need some way to know how much memory is used by some object to
improve the app. How can I do it?
I've used some OS specific things but they aren't convenient because
provide information about the whole application, instead of the
Alexandr Druzhinin:
so I need some way to know how much memory is used by some
object to improve the app. How can I do it?
I've used some OS specific things but they aren't convenient
because provide information about the whole application,
instead of the specific class instance. Simple size
Hi,
I just updated to DMD 2.062. I then tried to recompile somewhat bigger
project. After fixing some errors, I received dozens of errors like this:
Error 42: Symbol Undefined _D3std6string6formatFYAya (immutable(char)[]
std.string.format(, ...))
I didn't see them when compiled with DMD 2.060. I
Suddenly I detect that my application is using too much memory, so I
need some way to know how much memory is used by some object to improve
the app. How can I do it?
I've used some OS specific things but they aren't convenient because
provide information about the whole application, instead of
Brian Brady:
After much googling, I thought I found something on RosettaCode
that would do what I wanted
(http://rosettacode.org/wiki/Add_a_variable_to_a_class_instance_at_runtime#D)
but when I try to use it, it doesn't work. (Its actually adding
to a class, which may be better than a struct i
On Monday, 18 February 2013 at 05:26:39 UTC, Ali Çehreli wrote:
Thank you for the working solution.
[...]
Looking at the sample file you provide, what you call
"variables" look like data points.
Yes, apologies. Different languages using different terms to
describe, essentially the same thing.
On 2013-02-18 09:21, eGust wrote:
Thanks for your reply. Does anyone know, will it be added into D2's
standard library?
Not until someone makes a pull request.
p.s. About the code, I don't know how it work on other platform, but on
windows it will get a bad result if the path contains any no
On Monday, 18 February 2013 at 07:32:06 UTC, Jacob Carlborg wrote:
On 2013-02-18 04:28, eGust wrote:
I need to locate the directory of current executable file, but
I can't
find how to do that in Phobos. I tried
core.runtime.Runtime.args[0], but
failed. Is there a standard method of Phobos to do
On Sunday, 17 February 2013 at 22:26:16 UTC, Jonathan M Davis
wrote:
On Sunday, February 17, 2013 23:00:19 Michael wrote:
> That's not the meaning of static in that context.
As I understand a static class can't be instantiated.
I have no idea how you came to that conclusion. That's not what
47 matches
Mail list logo