Hello World Example with Glade?

2015-09-11 Thread Mike McKee via Digitalmars-d-learn
On Ubuntu Linux, I can draw a simple Hello World interface (and a button on it to close the window) with Glade and save the file. Now how do I use GtkD and D to load that interface? Anyone got a super simple tutorial for that?

Re: How To: Passing curried functions around

2015-09-11 Thread Ali Çehreli via Digitalmars-d-learn
On 09/06/2015 12:05 PM, Bahman Movaqar wrote: > alias bool function(int n) validator_t; There is the relatively newer alias syntax which is more intuitive: alias Validator = bool function(int n); > bool isEven(int n) { ... } > bool isPrime(int n) { ... } > /** > *

Re: Hello World Example with Glade?

2015-09-11 Thread Mike James via Digitalmars-d-learn
On Friday, 11 September 2015 at 06:45:07 UTC, Mike McKee wrote: On Friday, 11 September 2015 at 06:00:39 UTC, Mike McKee wrote: [...] I think the start of this probably looks like the following, but I'm not certain: import gtk; import gobject.Type; import std.stdio; import std.c.process;

Re: char[] ported from C to char[0] in the D core library

2015-09-11 Thread badlink via Digitalmars-d-learn
On Wednesday, 9 September 2015 at 19:37:54 UTC, Alex Parrill wrote: It's a flexible array member [1], not a pointer. Changing it to `char*` would make it incompatible with the C functions using it. [1]: https://en.wikipedia.org/wiki/Flexible_array_member TIL a new detail about C on the D

Re: Hello World Example with Glade?

2015-09-11 Thread Mike McKee via Digitalmars-d-learn
On Friday, 11 September 2015 at 06:00:39 UTC, Mike McKee wrote: On Ubuntu Linux, I can draw a simple Hello World interface (and a button on it to close the window) with Glade and save the file. Now how do I use GtkD and D to load that interface? Anyone got a super simple tutorial for that? I

Re: Multiple implicit type converters

2015-09-11 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 11 September 2015 at 16:25:53 UTC, Bahman Movaqar wrote: As only one `alias this` is possible for any type, how should one implement multiple implicit type converters? multiple alias this is supposed to work and might some day fyi But for today, the explicit is the only way to go.

Re: Multiple implicit type converters

2015-09-11 Thread Meta via Digitalmars-d-learn
On Friday, 11 September 2015 at 16:25:53 UTC, Bahman Movaqar wrote: As only one `alias this` is possible for any type, how should one implement multiple implicit type converters? Actually I'm looking for something similar to Groovy's `asType` method[1]. An example in Groovy: Point p =

Re: How To: Passing curried functions around

2015-09-11 Thread Ali Çehreli via Digitalmars-d-learn
On 09/11/2015 02:41 AM, Bahman Movaqar wrote: > On Friday, 11 September 2015 at 06:14:18 UTC, Ali Çehreli wrote: >> partial takes the function arguments as 'value template parameters'. >> Unfortunately, a function pointer like cannot be 'value >> template parameters'; only fundamental types and

Multiple implicit type converters

2015-09-11 Thread Bahman Movaqar via Digitalmars-d-learn
As only one `alias this` is possible for any type, how should one implement multiple implicit type converters? Actually I'm looking for something similar to Groovy's `asType` method[1]. An example in Groovy: Point p = new Point(1, 1) assert (p as BigDecimal[]) == [1, 1] assert

Re: shared array?

2015-09-11 Thread Kagamin via Digitalmars-d-learn
On Friday, 11 September 2015 at 14:54:00 UTC, Prudence wrote: But in this case it is static, so why does it matter? Do you have any ideas how to wrap it or fix this? It matters exactly because it is static. A code written for single-threaded environment may not work correctly in shared

Re: shared array?

2015-09-11 Thread Prudence via Digitalmars-d-learn
On Friday, 11 September 2015 at 16:04:22 UTC, Kagamin wrote: On Friday, 11 September 2015 at 14:54:00 UTC, Prudence wrote: But in this case it is static, so why does it matter? Do you have any ideas how to wrap it or fix this? It matters exactly because it is static. A code written for

Re: Hello World Example with Glade?

2015-09-11 Thread Mike James via Digitalmars-d-learn
On Friday, 11 September 2015 at 07:13:22 UTC, Mike McKee wrote: On Friday, 11 September 2015 at 06:53:07 UTC, Mike James wrote: There's a Glade example in the demos/builder directory... I'm having trouble installing GtkD on Ubuntu Linux 14.04. I did the apt steps from here:

Re: shared array?

2015-09-11 Thread Kagamin via Digitalmars-d-learn
I get only one error: Error: non-shared method std.container.array.Array!(void delegate()).Array.~this is not callable using a shared object. It will try to destruct the array on program termination, but it requires the destructor to be aware of the shared context.

Re: shared array?

2015-09-11 Thread Kagamin via Digitalmars-d-learn
You can try to write a wrapper for the array that it aware of concurrency.

Re: Hello World Example with Glade?

2015-09-11 Thread Mike McKee via Digitalmars-d-learn
On Friday, 11 September 2015 at 07:39:46 UTC, Mike James wrote: try # dmd test1.d -I/usr/include/dmd/gtkd3 # dmd test1.d -L-ldl -I/usr/include/dmd/gtkd3 test1.o:(.rodata+0x12c): undefined reference to `_D3gtk7Builder12__ModuleInfoZ' test1.o:(.rodata+0x130): undefined reference to

Re: Hello World Example with Glade?

2015-09-11 Thread Jordi Sayol via Digitalmars-d-learn
El 11/09/15 a les 09:13, Mike McKee via Digitalmars-d-learn ha escrit: > On Friday, 11 September 2015 at 06:53:07 UTC, Mike James wrote: >> There's a Glade example in the demos/builder directory... > > I'm having trouble installing GtkD on Ubuntu Linux 14.04. I did the apt steps > from here: >

Re: shared array?

2015-09-11 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, September 11, 2015 00:50:13 Adam D. Ruppe via Digitalmars-d-learn wrote: > On Friday, 11 September 2015 at 00:48:28 UTC, Prudence wrote: > > static Array!(bool delegate(int, WPARAM, LPARAM)) callbacks; > > Try just using a regular array instead of the library Array. > > > static bool

Re: What is "FilterResult" type?

2015-09-11 Thread Bahman Movaqar via Digitalmars-d-learn
On Wednesday, 9 September 2015 at 13:16:49 UTC, cym13 wrote: True. But is pumping the output of `filter` as the seed into `reduce` really considered weird usage!? I don't think it is really weird per se, I just can't think of a case where there isn't a better way to do it. I find it

Re: How To: Passing curried functions around

2015-09-11 Thread Bahman Movaqar via Digitalmars-d-learn
On Friday, 11 September 2015 at 06:14:18 UTC, Ali Çehreli wrote: On 09/06/2015 12:05 PM, Bahman Movaqar wrote: > alias bool function(int n) validator_t; There is the relatively newer alias syntax which is more intuitive: alias Validator = bool function(int n); Great. This is easily

Re: Hello World Example with Glade?

2015-09-11 Thread Mike McKee via Digitalmars-d-learn
On Friday, 11 September 2015 at 06:53:07 UTC, Mike James wrote: There's a Glade example in the demos/builder directory... I'm having trouble installing GtkD on Ubuntu Linux 14.04. I did the apt steps from here: http://d-apt.sourceforge.net/ $ sudo su # wget

Re: Hello World Example with Glade?

2015-09-11 Thread Jordi Sayol via Digitalmars-d-learn
El 11/09/15 a les 11:05, Jordi Sayol via Digitalmars-d-learn ha escrit: > El 11/09/15 a les 09:13, Mike McKee via Digitalmars-d-learn ha escrit: >> On Friday, 11 September 2015 at 06:53:07 UTC, Mike James wrote: >>> There's a Glade example in the demos/builder directory... >> >> I'm having trouble

Re: private selective import not so private ?

2015-09-11 Thread Gary Willoughby via Digitalmars-d-learn
On Friday, 11 September 2015 at 00:55:41 UTC, Adam D. Ruppe wrote: On Friday, 11 September 2015 at 00:52:00 UTC, BBasile wrote: While trying to get why some call to memmove without the right import didn't lead to a compilation failure i've found that imported symbols are not private ! Is that

Re: Hello World Example with Glade?

2015-09-11 Thread Mike McKee via Digitalmars-d-learn
On Friday, 11 September 2015 at 07:20:57 UTC, Mike James wrote: It looks last keep you're missing an import path (-Ipath_to_source). Check out http://dlang.org/dmd-linux.html#switches I tried this just now: # dmd test1.d -I/usr/include/dmd/gtkd3/gtkc /usr/include/dmd/gtkd3/gtkc/gtk.d(28):

Re: Hello World Example with Glade?

2015-09-11 Thread Mike James via Digitalmars-d-learn
On Friday, 11 September 2015 at 07:29:23 UTC, Mike McKee wrote: On Friday, 11 September 2015 at 07:20:57 UTC, Mike James wrote: It looks last keep you're missing an import path (-Ipath_to_source). Check out http://dlang.org/dmd-linux.html#switches I tried this just now: # dmd test1.d

Re: Hello World Example with Glade?

2015-09-11 Thread Mike James via Digitalmars-d-learn
On Friday, 11 September 2015 at 07:47:15 UTC, Mike McKee wrote: [...] The undefined references mean you haven't provided a linker path to the GtkD libs. Have you built the GtkD libraries? Check out https://github.com/gtkd-developers/GtkD

Re: shared array?

2015-09-11 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 11 September 2015 at 17:29:47 UTC, Prudence wrote: I don't care about "maybe" working. Since the array is hidden inside a class I can control who and how it is used and deal with the race conditions. You could use __gshared instead of shared. It means put it in non-tls storage,

Re: Multiple implicit type converters

2015-09-11 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 11 September 2015 at 19:51:09 UTC, Dave Akers wrote: Would it be possible to create it as an 'as' template? Yeah, the way I'd do it is something like: T as(T)() { import std.traits; static if(isIntegral!T) return to!T(convert_to_some_int); else static

Re: shared array?

2015-09-11 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 11 September 2015 at 20:06:53 UTC, Prudence wrote: Can you back up this claim? Not saying your lying, I'd just like to know it's true for a fact? The list of things that trigger the GC is pretty short. See the bottom of this page: http://dlang.org/garbage.html Basically, the

Re: Huge output size for simple programs

2015-09-11 Thread Johannes Pfau via Digitalmars-d-learn
Am Fri, 11 Sep 2015 05:36:27 -0700 schrieb Jonathan M Davis via Digitalmars-d-learn : > Now, as to why the gdc binary is so large, I don't know. My guess is > that it has something to do with the debug symbols. You could try > building with -g or -gc to see how

Re: Hello World Example with Glade?

2015-09-11 Thread Mike Wey via Digitalmars-d-learn
On 09/11/2015 04:00 PM, Mike McKee wrote: On Friday, 11 September 2015 at 09:07:37 UTC, Jordi Sayol wrote: On there is the "pkg-config" section: I finally got it to compile with your help, guys! :) Here's what I had to type: # dmd test1.d -L-ldl

Re: Calling D from C, C++, Python…

2015-09-11 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-09-10 20:01, Russel Winder via Digitalmars-d-learn wrote: Is there an easy way of knowing when you do not have to initialize the D runtime system to call D code from, in this case, Python via a C adapter? You always need to initialize the D runtime, unless you have a D main function.

Re: Multiple implicit type converters

2015-09-11 Thread Dave Akers via Digitalmars-d-learn
On Friday, 11 September 2015 at 19:34:46 UTC, Bahman Movaqar wrote: On Friday, 11 September 2015 at 16:33:52 UTC, Meta wrote: The only ways to get implicit conversion between two types in D are through `alias this`, inheritance, or implementing an interface. That's enough for me, I suppose.

Re: Multiple implicit type converters

2015-09-11 Thread Bahman Movaqar via Digitalmars-d-learn
On Friday, 11 September 2015 at 19:51:09 UTC, Dave Akers wrote: That's enough for me, I suppose. I am thinking of having a family of functions in my structs/classes as `as` family, such as `asDouble`, `asFooBar`. Would it be possible to create it as an 'as' template? Hmm...there's already

Re: Multiple implicit type converters

2015-09-11 Thread Bahman Movaqar via Digitalmars-d-learn
On Friday, 11 September 2015 at 16:33:52 UTC, Meta wrote: The only ways to get implicit conversion between two types in D are through `alias this`, inheritance, or implementing an interface. That's enough for me, I suppose. I am thinking of having a family of functions in my structs/classes

Re: Multiple implicit type converters

2015-09-11 Thread Bahman Movaqar via Digitalmars-d-learn
On Friday, 11 September 2015 at 16:31:46 UTC, Adam D. Ruppe wrote: explicit is the only way to go. That's easy to do, just write like a .get method or something that does the conversion and returns it. Fair enough. Type conversion is one of those spots that I'd like it to as explicit as

Re: shared array?

2015-09-11 Thread Prudence via Digitalmars-d-learn
On Friday, 11 September 2015 at 19:27:49 UTC, Adam D. Ruppe wrote: On Friday, 11 September 2015 at 17:29:47 UTC, Prudence wrote: I don't care about "maybe" working. Since the array is hidden inside a class I can control who and how it is used and deal with the race conditions. You could use

Re: How To: Passing curried functions around

2015-09-11 Thread Bahman Movaqar via Digitalmars-d-learn
On Friday, 11 September 2015 at 18:39:15 UTC, Ali Çehreli wrote: >> import std.stdio; >> >> bool isEven(int n) { >> return !(n % 2); >> } >> >> int readValidInt(alias validator)(string prompt) { readValidInt() is a function template that takes two information: 1) The validator as its

Re: How To: Passing curried functions around

2015-09-11 Thread Ali Çehreli via Digitalmars-d-learn
On 09/11/2015 01:07 PM, Bahman Movaqar wrote: > On Friday, 11 September 2015 at 18:39:15 UTC, Ali Çehreli wrote: >> >> import std.stdio; >> >> >> >> bool isEven(int n) { >> >> return !(n % 2); >> >> } >> >> >> >> int readValidInt(alias validator)(string prompt) { >> >> readValidInt() is a

Re: How To: Passing curried functions around

2015-09-11 Thread Ali Çehreli via Digitalmars-d-learn
On 09/11/2015 02:04 PM, Ali Çehreli wrote: The same keyword has a different use with templates: And the official documentation: http://dlang.org/template.html#TemplateAliasParameter Ali

Re: shared array?

2015-09-11 Thread Prudence via Digitalmars-d-learn
On Friday, 11 September 2015 at 20:30:37 UTC, Adam D. Ruppe wrote: On Friday, 11 September 2015 at 20:06:53 UTC, Prudence wrote: Can you back up this claim? Not saying your lying, I'd just like to know it's true for a fact? The list of things that trigger the GC is pretty short. See the

Re: best way to memoize a range?

2015-09-11 Thread Laeeth Isharc via Digitalmars-d-learn
On Friday, 11 September 2015 at 13:31:06 UTC, John Colvin wrote: On Friday, 11 September 2015 at 13:09:33 UTC, Laeeth Isharc wrote: obviously it's trivial to do with a little aa cache. and I know I can memoize a function, and turn the memoized version into an infinite range. but suppose I

Re: shared array?

2015-09-11 Thread Laeeth Isharc via Digitalmars-d-learn
On Friday, 11 September 2015 at 21:58:28 UTC, Adam D. Ruppe wrote: On Friday, 11 September 2015 at 21:48:14 UTC, Prudence wrote: Oh really?!?! I thought slicing used the GC? Is this a recent development or always been that way? Always been that way. A D slice is just a C pointer + length

Re: friends with phobos, workaround?

2015-09-11 Thread Daniel N via Digitalmars-d-learn
On Thursday, 10 September 2015 at 13:19:08 UTC, Adam D. Ruppe wrote: On Thursday, 10 September 2015 at 08:22:29 UTC, Daniel N wrote: this(string caller = __MODULE__)(int val) if(caller == "std.conv") // Use scoped!Awesome That's disgustingly genius. I'm a bit jealous I didn't think of

Re: shared array?

2015-09-11 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 11 September 2015 at 21:48:14 UTC, Prudence wrote: Oh really?!?! I thought slicing used the GC? Is this a recent development or always been that way? Always been that way. A D slice is just a C pointer + length packed together. A slice simply increments the pointer and/or

Huge output size for simple programs

2015-09-11 Thread NX via Digitalmars-d-learn
I compile a simple hello world program in C and the results: hello_world.o -> 1.5 KB hello_world (linux executable) -> 8.5 KB Then I compile a simple hello world program in D (using DMD) and the results: hello_world.o -> 9.3 KB hello_world (linux executable) -> 575.9 KB Then I compile a

Re: Huge output size for simple programs

2015-09-11 Thread Daniel N via Digitalmars-d-learn
On Friday, 11 September 2015 at 11:15:33 UTC, NX wrote: I compile a simple hello world program in C and the results: hello_world.o -> 1.5 KB hello_world (linux executable) -> 8.5 KB If you care about binary sizes, use ldc2: ldc 225544 bytes (stripped + writeln) ldc 175736 bytes (stripped +

Re: Version for windows/console compilation?

2015-09-11 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 11 September 2015 at 04:30:44 UTC, Prudence wrote: I'm using Visual D and I assume it takes care of all this. It works so that's not a huge problem. If it is taking care of the linker switch, then you gain nothing but more complicated and fragile code by writing a WinMain! I was

Re: Huge output size for simple programs

2015-09-11 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 11 September 2015 at 11:15:33 UTC, NX wrote: hello_world (linux executable) -> 13 MB !!! Try running `strip yourexecutable` on all compilers, but on gdc it should make the biggest difference. It brings debugging info and exported symbols. Is this because whole GC implementation

Re: Hello World Example with Glade?

2015-09-11 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 11 September 2015 at 14:00:30 UTC, Mike McKee wrote: I finally got it to compile with your help, guys! :) Here's what I had to type: # dmd test1.d -L-ldl -I/usr/include/dmd/gtkd3 `pkg-config --cflags --libs gtkd3` Don't forget to answer yourself on SO too!

Re: best way to memoize a range?

2015-09-11 Thread John Colvin via Digitalmars-d-learn
On Friday, 11 September 2015 at 13:09:33 UTC, Laeeth Isharc wrote: obviously it's trivial to do with a little aa cache. and I know I can memoize a function, and turn the memoized version into an infinite range. but suppose I have a lazy function that returns a finite range, and its expensive

Re: Hello World Example with Glade?

2015-09-11 Thread Mike McKee via Digitalmars-d-learn
On Friday, 11 September 2015 at 09:07:37 UTC, Jordi Sayol wrote: On there is the "pkg-config" section: I finally got it to compile with your help, guys! :) Here's what I had to type: # dmd test1.d -L-ldl -I/usr/include/dmd/gtkd3 `pkg-config --cflags --libs

Re: Multidimension AA's and remove

2015-09-11 Thread NX via Digitalmars-d-learn
On Saturday, 12 September 2015 at 03:44:50 UTC, Prudence wrote: At the very least: Is T[][S] an associative array with keys of type S and values of an array of type T or is it backwards? Also, how to disambiguate Thanks. Indeed. void main() { import std.stdio : writeln,

Re: Hello World Example with Glade?

2015-09-11 Thread Gary Willoughby via Digitalmars-d-learn
On Friday, 11 September 2015 at 07:13:22 UTC, Mike McKee wrote: I'm having trouble installing GtkD on Ubuntu Linux 14.04. Here's an old guide I wrote years ago. It might be a little out of date but may help you put things together:

Lazy sort

2015-09-11 Thread ixid via Digitalmars-d-learn
Does sort have to be eager or would it be possible to have a lazy version? It's messy to always have to use array and leap in and out of lazy operations within a UFCS chain. Surely as many functions as possible should be optionally lazy.

Re: Lazy sort

2015-09-11 Thread Chris via Digitalmars-d-learn
On Friday, 11 September 2015 at 10:41:16 UTC, ixid wrote: Does sort have to be eager or would it be possible to have a lazy version? It's messy to always have to use array and leap in and out of lazy operations within a UFCS chain. Surely as many functions as possible should be optionally

Re: Lazy sort

2015-09-11 Thread via Digitalmars-d-learn
On Friday, 11 September 2015 at 10:41:16 UTC, ixid wrote: Does sort have to be eager or would it be possible to have a lazy version? It's messy to always have to use array and leap in and out of lazy operations within a UFCS chain. Surely as many functions as possible should be optionally

Is this a bug?

2015-09-11 Thread Rene Zwanenburg via Digitalmars-d-learn
The following fails to compile with an 'cannot deduce function from argument types' error. When using an array of something other than TypeInfo_Class everything works as expected. void main() { import std.algorithm.mutation : remove; TypeInfo_Class[] arr;

Re: Is this a bug?

2015-09-11 Thread anonymous via Digitalmars-d-learn
On Friday 11 September 2015 12:33, Rene Zwanenburg wrote: > The following fails to compile with an 'cannot deduce function > from argument types' error. When using an array of something > other than TypeInfo_Class everything works as expected. > > void main() > { > import

Re: Lazy sort

2015-09-11 Thread deed via Digitalmars-d-learn
On Friday, 11 September 2015 at 10:41:16 UTC, ixid wrote: Does sort have to be eager or would it be possible to have a lazy version? It's messy to always have to use array and leap in and out of lazy operations within a UFCS chain. Surely as many functions as possible should be optionally

Multidimension AA's and remove

2015-09-11 Thread Prudence via Digitalmars-d-learn
Error: template std.algorithm.mutation.remove cannot deduce function from argument types !()(bool delegate(void*, uint, uint, int)[], void), candidates are: std.algorithm.mutation.remove(SwapStrategy s = SwapStrategy.stable, Range, Offset...)(Range range, Offset offset) if (s !=

Re: Is this a bug?

2015-09-11 Thread Rene Zwanenburg via Digitalmars-d-learn
On Friday, 11 September 2015 at 11:26:49 UTC, anonymous wrote: On Friday 11 September 2015 12:33, Rene Zwanenburg wrote: The following fails to compile with an 'cannot deduce function from argument types' error. When using an array of something other than TypeInfo_Class everything works as

Re: Huge output size for simple programs

2015-09-11 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, September 11, 2015 11:15:31 NX via Digitalmars-d-learn wrote: > I compile a simple hello world program in C and the results: > > hello_world.o -> 1.5 KB > hello_world (linux executable) -> 8.5 KB > > > Then I compile a simple hello world program in D (using DMD) and > the results: > >

best way to memoize a range?

2015-09-11 Thread Laeeth Isharc via Digitalmars-d-learn
obviously it's trivial to do with a little aa cache. and I know I can memoize a function, and turn the memoized version into an infinite range. but suppose I have a lazy function that returns a finite range, and its expensive to calculate. can I use Phobos to produce a memoized range? So

Re: using std.algorithm to find intersection of DateTime[][] arg

2015-09-11 Thread Laeeth Isharc via Digitalmars-d-learn
On Thursday, 10 September 2015 at 11:58:10 UTC, deed wrote: On Wednesday, 9 September 2015 at 20:28:35 UTC, Laeeth Isharc wrote: I have a DateTime[][] arg ... I would like to find the intersection of the dates. A suggestion: auto minLength = arg.map!(a => a.length).reduce!min; auto

Re: best way to memoize a range?

2015-09-11 Thread Jakob Ovrum via Digitalmars-d-learn
On Friday, 11 September 2015 at 13:09:33 UTC, Laeeth Isharc wrote: obviously it's trivial to do with a little aa cache. and I know I can memoize a function, and turn the memoized version into an infinite range. but suppose I have a lazy function that returns a finite range, and its expensive

Re: shared array?

2015-09-11 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 11 September 2015 at 04:28:52 UTC, Prudence wrote: I thought about that but then I have to rely on the GC for some simple things. Doesn't seem like the right way to go. Since it is static, it will never be collected anyway, so you could just use it and it'll work for convenience

Re: Lazy sort

2015-09-11 Thread ixid via Digitalmars-d-learn
On Friday, 11 September 2015 at 11:08:29 UTC, Ola Fosheim Grøstad wrote: On Friday, 11 September 2015 at 10:41:16 UTC, ixid wrote: Does sort have to be eager or would it be possible to have a lazy version? It's messy to always have to use array and leap in and out of lazy operations within a

Re: Huge output size for simple programs

2015-09-11 Thread John Colvin via Digitalmars-d-learn
On Friday, 11 September 2015 at 11:15:33 UTC, NX wrote: I compile a simple hello world program in C and the results: hello_world.o -> 1.5 KB hello_world (linux executable) -> 8.5 KB Then I compile a simple hello world program in D (using DMD) and the results: hello_world.o -> 9.3 KB

Re: Lazy sort

2015-09-11 Thread via Digitalmars-d-learn
On Friday, 11 September 2015 at 12:23:52 UTC, ixid wrote: Yes, I was reading about heapsort. I was only thinking about the usability POV (I mean isn't reduced pretty much an eager operation that accepts a lazy input? Why can't sort do that?) but it could also offer some performance improvement

Re: shared array?

2015-09-11 Thread Prudence via Digitalmars-d-learn
On Friday, 11 September 2015 at 13:12:14 UTC, Adam D. Ruppe wrote: On Friday, 11 September 2015 at 04:28:52 UTC, Prudence wrote: I thought about that but then I have to rely on the GC for some simple things. Doesn't seem like the right way to go. Since it is static, it will never be collected

Re: Version for windows/console compilation?

2015-09-11 Thread Mike Parker via Digitalmars-d-learn
On Friday, 11 September 2015 at 04:30:44 UTC, Prudence wrote: I'm simply creating my own version flags in VD properties. Not the best way because I'll have to remember to set the flags every time I use the library or I'll get errors about stuff missing. I was hoping D had a flag to

Re: Huge output size for simple programs

2015-09-11 Thread NX via Digitalmars-d-learn
On Friday, 11 September 2015 at 13:45:03 UTC, Adam D. Ruppe wrote: Just D's isn't preinstalled so it carries what it needs with the executable for broadest compatibility. You could dynamically link if you like (`-defaultlib=libphobos2.so` on dmd linux) So I did some testing: # dmd

Re: Huge output size for simple programs

2015-09-11 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 11 September 2015 at 14:30:00 UTC, NX wrote: One question: Why? use the map viewer to get more info: http://thecybershadow.net/d/mapview/ use dmd -map to create the file it wants

Re: shared array?

2015-09-11 Thread Prudence via Digitalmars-d-learn
On Friday, 11 September 2015 at 07:41:10 UTC, Kagamin wrote: I get only one error: Error: non-shared method std.container.array.Array!(void delegate()).Array.~this is not callable using a shared object. It will try to destruct the array on program termination, but it requires the destructor

Re: shared array?

2015-09-11 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 11 September 2015 at 14:47:15 UTC, Prudence wrote: If it's never collected and the GC scans it every time, it means it adds a constant overhead to the GC for absolutely no reason, right? GC overhead isn't quite constant, it happens only when you call for a collection cycle. But