Re: Building DMD on SmartOS

2015-05-02 Thread Daniel Murphy via Digitalmars-d
flamencofantasy wrote in message news:zhcduibirwprgbzqk...@forum.dlang.org... Hello, I would like to use D on SmartOS. Since there is no binary installer I tried to build DMD from source by following the instructions on this page; http://wiki.dlang.org/Building_DMD Unfortunately I get

Builtin Support for Comparison Function for Primitive Types

2015-05-02 Thread via Digitalmars-d-learn
Why doesn't std.algorithm.comparison.cmp support primitive types such as assert(cmp(0,1) == true); ?

Re: A slice can lose capacity simply by calling a function

2015-05-02 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, May 02, 2015 01:21:14 Ali Çehreli via Digitalmars-d-learn wrote: 2) void foo(const(int[]) arr); // cannot affect anything // (even capacity) Actually, you can modify the capacity of arr quite easily. All you have to do is slice it

Re: Merging one Array with Another

2015-05-02 Thread via Digitalmars-d-learn
On Friday, 1 May 2015 at 19:30:08 UTC, Ilya Yaroshenko wrote: Both variants are wrong because uniq needs sorted ranges. Probably you need something like that: x = x.chain(y).sort.uniq.array; Interesting. Is x = x.chain(y).sort faster than x ~= y; x.sort; ? If so why?

Re: Builtin Support for Comparison Function for Primitive Types

2015-05-02 Thread via Digitalmars-d-learn
On Saturday, 2 May 2015 at 08:29:11 UTC, Per Nordlöw wrote: Why doesn't std.algorithm.comparison.cmp support primitive types such as assert(cmp(0,1) == true); ? Correction if mean assert(cmp(0,1) == -1);

Re: Builtin Support for Comparison Function for Primitive Types

2015-05-02 Thread via Digitalmars-d-learn
On Saturday, 2 May 2015 at 08:29:11 UTC, Per Nordlöw wrote: Why doesn't std.algorithm.comparison.cmp support primitive types such as assert(cmp(0,1) == true); ? I just found some forgotten code of my that solves it through import std.range: only; assert(cmp(only(0), only(1)) ==

Re: ARM Cortex-M Microcontroller startup files

2015-05-02 Thread Martin Nowak via Digitalmars-d
On Saturday, 2 May 2015 at 04:53:51 UTC, Jens Bauer wrote: The problem I've seen with most C-solutions, is that once someone uses printf, the binary suddenly grows out of proportions. (It may be because the programmer included a line for debugging only, and that causes the otherwise 1K program

Re: Merging one Array with Another

2015-05-02 Thread Meta via Digitalmars-d-learn
On Saturday, 2 May 2015 at 10:18:07 UTC, Per Nordlöw wrote: On Friday, 1 May 2015 at 19:30:08 UTC, Ilya Yaroshenko wrote: Both variants are wrong because uniq needs sorted ranges. Probably you need something like that: x = x.chain(y).sort.uniq.array; Interesting. Is x =

Re: ARM Cortex-M Microcontroller startup files

2015-05-02 Thread Johannes Pfau via Digitalmars-d
Am Sat, 02 May 2015 06:40:06 + schrieb Mike n...@none.com: On Friday, 1 May 2015 at 06:57:08 UTC, Timo Sintonen wrote: I think we should omit moduleinfo totally and so we can not have module constructors. I think pointers to static constructors are available in a certain section

Re: ARM Cortex-M Microcontroller startup files

2015-05-02 Thread Martin Nowak via Digitalmars-d
On Saturday, 2 May 2015 at 08:33:34 UTC, Timo Sintonen wrote: It is ok for me and it is used in our production code that does not yet use D. I am still open for other solutions. These functions should be at least extern C because library code written in C may use them. Newlib already comes

Re: ARM Cortex-M Microcontroller startup files

2015-05-02 Thread Mike via Digitalmars-d
On Friday, 1 May 2015 at 07:34:04 UTC, Johannes Pfau wrote: TLDR: I'd prefer using @cctor extern(C) void foo() {} instead of normal d module ctors. Bonus points: You can have more than one @cctor per module. How do you propose defining calling order with this feature?

[Issue 2043] Closure outer variables in nested blocks are not allocated/instantiated correctly: should have multiple instances but only have one.

2015-05-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=2043 --- Comment #23 from Artem Borisovskiy kolo...@bk.ru --- (In reply to Walter Bright from comment #21) The most practical solution is to simply disallow referencing variables from a dynamic closure that end sooner than the closing } of the function.

Re: ARM Cortex-M Microcontroller startup files

2015-05-02 Thread Timo Sintonen via Digitalmars-d
On Saturday, 2 May 2015 at 02:08:40 UTC, Mike wrote: I'm totally with you on this. I don't want a better C or a worse D. I hope that programming in D on these microcontrollers looks very much like the idomatic D in other domains. I want dyanamic memory allocation to be available for sure,

[hackathon] FreeTree is FreeList on autotune

2015-05-02 Thread Andrei Alexandrescu via Digitalmars-d-announce
I'm just done implementing a pretty cool allocator: FreeTree. https://github.com/andralex/phobos/blob/allocator/std/experimental/allocator/free_tree.d http://erdani.com/d/phobos-prerelease/std_experimental_allocator_free_tree.html It's similar to the classic free list allocator but instead of

A slice can lose capacity simply by calling a function

2015-05-02 Thread Ali Çehreli via Digitalmars-d-learn
This is related to a discussion[1] that I had started recently but I will give an even shorter example here: void main() { // Two slices to all element auto a = [ 1, 2, 3, 4 ]; auto b = a; // Initially, they both have capacity (strange! :) ) assert(a.capacity == 7);

Re: ARM Cortex-M Microcontroller startup files

2015-05-02 Thread Timo Sintonen via Digitalmars-d
On Saturday, 2 May 2015 at 04:53:51 UTC, Jens Bauer wrote: The problem I've seen with most C-solutions, is that once someone uses printf, the binary suddenly grows out of proportions. (It may be because the programmer included a line for debugging only, and that causes the otherwise 1K

[Issue 14519] [Enh] foreach on strings should return replacementDchar rather than throwing

2015-05-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14519 --- Comment #25 from Vladimir Panteleev thecybersha...@gmail.com --- (In reply to Martin Nowak from comment #24) If we validate encoding on data entry points such as readText or byLine, then decoding errors should be assertions rather than silent

Re: ARM Cortex-M Microcontroller startup files

2015-05-02 Thread Timo Sintonen via Digitalmars-d
On Saturday, 2 May 2015 at 09:09:44 UTC, Martin Nowak wrote: On Saturday, 2 May 2015 at 08:46:56 UTC, Timo Sintonen wrote: Std.format, as suggested, would be too big. I tis easty to copy the printf formatter from libc sources. Or just write an own. No need to rewrite libc, just link against

Re: ARM Cortex-M Microcontroller startup files

2015-05-02 Thread Martin Nowak via Digitalmars-d
On Saturday, 2 May 2015 at 04:53:51 UTC, Jens Bauer wrote: Is it possible to write the malloc so it's garbage collector-friendly ? Garbage collection on microcontrollers doesn't make sense, because the memory consumption will always be significantly higher than with deterministic memory

Re: [hackathon] FreeTree is FreeList on autotune

2015-05-02 Thread Meta via Digitalmars-d-announce
On Saturday, 2 May 2015 at 06:28:01 UTC, Andrei Alexandrescu wrote: I'm just done implementing a pretty cool allocator: FreeTree. https://github.com/andralex/phobos/blob/allocator/std/experimental/allocator/free_tree.d

Re: ARM Cortex-M Microcontroller startup files

2015-05-02 Thread Martin Nowak via Digitalmars-d
On Friday, 1 May 2015 at 06:57:08 UTC, Timo Sintonen wrote: * Is dynamic memory allocation a requirement of D, or a library feature? We should agree whether we are making only yet another C compiler or do we want the D compiler. The ability to use object oriented features was the reason I

Re: ARM Cortex-M Microcontroller startup files

2015-05-02 Thread Martin Nowak via Digitalmars-d
On Saturday, 2 May 2015 at 08:46:56 UTC, Timo Sintonen wrote: Std.format, as suggested, would be too big. I tis easty to copy the printf formatter from libc sources. Or just write an own. No need to rewrite libc, just link against it and use whatever is needed. It is a matter of taste if it

Re: if(arr) now a warning

2015-05-02 Thread Jonathan M Davis via Digitalmars-d
On Friday, 1 May 2015 at 09:54:43 UTC, Walter Bright wrote: This really blows. And things like that isnan = isNaN really has GOT TO STOP. Just today I found it broke some older piece of code I had that's perfectly correct. I don't know anything about that one, so if that's a recent one, I

[Issue 4733] Possible bugs caused by dynamic arrays in boolean evaluation context

2015-05-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=4733 --- Comment #31 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/72e8bfd2ac371d9a2acc34d7313882a5c4547ce0 Revert Fix Issue 4733 -

[Issue 14519] [Enh] foreach on strings should return replacementDchar rather than throwing

2015-05-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14519 --- Comment #26 from Vladimir Panteleev thecybersha...@gmail.com --- (In reply to Sobirari Muhomori from comment #21) Libraries don't determine on which data the program operates, it depends on the program and its environment, encoding mismatch has

Re: if(arr) now a warning

2015-05-02 Thread Vladimir Panteleev via Digitalmars-d
On Saturday, 2 May 2015 at 09:20:50 UTC, Jonathan M Davis wrote: The only problem I see with making the change has been a couple of very vocal folks [...] (since it's Andrei and Cybershadow who are complaining) You either die a hero, or live long enough to see yourself become the villain.

Re: if(arr) now a warning

2015-05-02 Thread Martin Nowak via Digitalmars-d
On Friday, 1 May 2015 at 19:45:18 UTC, Walter Bright wrote: I suspect this kind of change and check would be appropriate for a D linter, and not be part of the core language. Yes it would fit nicely into a static analyzer, but DMD is currently the only semantic analyzer we have.

Re: ARM Cortex-M Microcontroller startup files

2015-05-02 Thread Jens Bauer via Digitalmars-d
On Saturday, 2 May 2015 at 10:38:51 UTC, Timo Sintonen wrote: On Saturday, 2 May 2015 at 09:09:44 UTC, Martin Nowak wrote: On Saturday, 2 May 2015 at 08:46:56 UTC, Timo Sintonen wrote: No need to rewrite libc, just link against it and use whatever is needed. I have assumed we are going the

Re: Merging one Array with Another

2015-05-02 Thread via Digitalmars-d-learn
On Saturday, 2 May 2015 at 11:16:30 UTC, Meta wrote: Probably the latter is slower than the former, at the very least because the latter requires memory allocation whereas the former does not. Ahh!, auto x = [11, 3, 2, 4, 5, 1]; auto y = [0, 3, 10, 2, 4, 5, 1]; auto z =

Re: stdx.data.json - enhancement suggestions

2015-05-02 Thread Laeeth Isharc via Digitalmars-d-learn
On Friday, 1 May 2015 at 20:04:58 UTC, Ilya Yaroshenko wrote: This line can be removed: .map!(ch = ch.idup) On Friday, 1 May 2015 at 20:02:46 UTC, Ilya Yaroshenko wrote: Current std.stdio is deprecated. This ad-hoc should works. auto json = File(fileName)

Re: A slice can lose capacity simply by calling a function

2015-05-02 Thread Ali Çehreli via Digitalmars-d-learn
On 05/02/2015 01:56 AM, Jonathan M Davis via Digitalmars-d-learn wrote: I really don't think that it's reasonable in the general case to expect to be able to guarantee that the capacity of a dynamic array won't change. Yes, it is very different from other languages like C and C++ that

Re: [hackathon] FreeTree is FreeList on autotune

2015-05-02 Thread Andrei Alexandrescu via Digitalmars-d-announce
On 5/2/15 4:11 AM, Meta wrote: I forget what the rules are for allocators exactly, but isn't something only an allocator if it defines allocate, deallocate, owns, etc.? It just seems weird that you mentioned something that I thought was implicit. All members except alignment and allocate are

Re: compile time garbage collection

2015-05-02 Thread ketmar via Digitalmars-d
On Sat, 02 May 2015 15:10:10 +, Freddy wrote: How crazy hard would it be to have a front end optimization pass that would try to replace garbage collector calls with malloc / free? impossible. signature.asc Description: PGP signature

[Issue 2043] Closure outer variables in nested blocks are not allocated/instantiated correctly: should have multiple instances but only have one.

2015-05-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=2043 --- Comment #24 from timon.g...@gmx.ch --- (In reply to Walter Bright from comment #21) The most practical solution is to simply disallow referencing variables from a dynamic closure that end sooner than the closing } of the function. Why?

[Issue 14537] New: Declaring an extern(C++) function in a variadic function template results in an ICE.

2015-05-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14537 Issue ID: 14537 Summary: Declaring an extern(C++) function in a variadic function template results in an ICE. Product: D Version: D2 Hardware: x86_64 OS: Linux

Re: if(arr) now a warning

2015-05-02 Thread Steven Schveighoffer via Digitalmars-d
On 4/30/15 5:34 AM, Byron Heads wrote: On Wed, 29 Apr 2015 22:44:22 -0400, Steven Schveighoffer wrote: On 4/29/15 8:35 PM, Martin Nowak wrote: Occasionally I'm using if (auto ary = func()), despite the fact that the semantics are wrong, but it's nice and short and works as long a func always

Re: [OT] compiler optimisations

2015-05-02 Thread via Digitalmars-d
On Friday, 24 April 2015 at 07:33:42 UTC, weaselcat wrote: C++ has mach7 for pattern matching, all done in metaprogramming AFAIK. I doubt anything like that could be done in D without being far uglier. Ran across this paper that describes C++ patternmatching, haven't studied it closely, but

Re: array operations and ranges

2015-05-02 Thread Manu via Digitalmars-d
On 1 May 2015 at 15:10, Walter Bright via Digitalmars-d digitalmars-d@puremagic.com wrote: On 4/26/2015 3:17 AM, Manu via Digitalmars-d wrote: There must be years of thoughts and work on this sort of thing? It seems arrays and ranges are unnecessarily distanced from eachother... what are the

Re: Interrogative: What's a good blog title?

2015-05-02 Thread via Digitalmars-d
On Monday, 27 April 2015 at 22:54:07 UTC, Andrei Alexandrescu wrote: Generally I'm looking for a phrase that's catchy but doesn't remind one of something else. Something contradictory, funny, etc. Please let me know of any thoughts you might have! Only silly ones: bloggeD beyonDcee

Re: Reducing source code: weak+alias values in array

2015-05-02 Thread Jens Bauer via Digitalmars-d-learn
On Saturday, 2 May 2015 at 13:08:27 UTC, Artur Skawina wrote: On 05/02/15 05:28, Jens Bauer via Digitalmars-d-learn wrote: On Saturday, 2 May 2015 at 03:21:38 UTC, Jens Bauer wrote: For some reason, my build time has increased dramatically... Building with 1 vector takes 0.6 seconds. Building

Does anyone want to work on bindings for Unreal Engine 4?

2015-05-02 Thread maik klein via Digitalmars-d
Follow up for http://forum.dlang.org/thread/hdabrcwmycsacmduj...@forum.dlang.org I am currently working on a medium sized project in Ue4 and the compile times are not so great anymore. I am currently thinking about maintaining bindings for D even though I am not a D user. I haven't really

Re: stdx.data.json - enhancement suggestions

2015-05-02 Thread Laeeth Isharc via Digitalmars-d-learn
It doesn't like it. Any thoughts ? lexer.d(257): Error: safe function 'stdx.data.json.parser.JSONLexerRange!(MapResult!(__lambda3, Result), cast(LexOptions)0, __lambda31).JSONLexerRange.empty' cannot call system function 'app.lookupTickers.MapResult!(__lambda3, Result).MapResult.empty'

Reading bzipped files

2015-05-02 Thread via Digitalmars-d-learn
Have anybody cooked up any range adaptors for on the fly decoding of bzipped files? Preferable compatible with phobos standard interfaces for file io. Should probably be built on top of http://code.dlang.org/packages/bzip2

Re: if(arr) now a warning

2015-05-02 Thread Steven Schveighoffer via Digitalmars-d
On 4/29/15 11:14 PM, Iain Buclaw via Digitalmars-d wrote: On 30 April 2015 at 04:41, Steven Schveighoffer via Digitalmars-d digitalmars-d@puremagic.com wrote: On 4/29/15 4:29 AM, Iain Buclaw via Digitalmars-d wrote: On 29 April 2015 at 06:38, Steven Schveighoffer via Digitalmars-d

Re: Building DMD on SmartOS

2015-05-02 Thread Jason King via Digitalmars-d
Note that phobos hasn't been fully tested -- there's probably some fixes that'll need to happen in there. On Sat, May 2, 2015 at 1:14 AM, Daniel Murphy via Digitalmars-d digitalmars-d@puremagic.com wrote: flamencofantasy wrote in message news:zhcduibirwprgbzqk...@forum.dlang.org... Hello,

compile time garbage collection

2015-05-02 Thread Freddy via Digitalmars-d
How crazy hard would it be to have a front end optimization pass that would try to replace garbage collector calls with malloc / free?

Re: ARM Cortex-M Microcontroller startup files

2015-05-02 Thread Jens Bauer via Digitalmars-d
On Saturday, 2 May 2015 at 08:46:56 UTC, Timo Sintonen wrote: On Saturday, 2 May 2015 at 04:53:51 UTC, Jens Bauer wrote: Std.format, as suggested, would be too big. I tis easty to copy the printf formatter from libc sources. Or just write an own. It does not have to support all the features.

Re: Reducing source code: weak+alias values in array

2015-05-02 Thread Artur Skawina via Digitalmars-d-learn
On 05/02/15 05:28, Jens Bauer via Digitalmars-d-learn wrote: On Saturday, 2 May 2015 at 03:21:38 UTC, Jens Bauer wrote: For some reason, my build time has increased dramatically... Building with 1 vector takes 0.6 seconds. Building with 2 vector takes 0.7 seconds. Building with 4 vector

Re: Destruction in D

2015-05-02 Thread via Digitalmars-d-learn
On Friday, 1 May 2015 at 18:37:41 UTC, Idan Arye wrote: On Friday, 1 May 2015 at 17:45:02 UTC, bitwise wrote: On Friday, 1 May 2015 at 02:35:52 UTC, Idan Arye wrote: On Thursday, 30 April 2015 at 23:27:49 UTC, bitwise wrote: Well, the third thing was just my reasoning for asking in the first

[Issue 14536] New: Calling destroy() on a on an extern(C++) class causes a segfault

2015-05-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14536 Issue ID: 14536 Summary: Calling destroy() on a on an extern(C++) class causes a segfault Product: D Version: D2 Hardware: x86_64 OS: Linux Status:

Re: ARM Cortex-M Microcontroller startup files

2015-05-02 Thread Jens Bauer via Digitalmars-d
On Saturday, 2 May 2015 at 09:17:57 UTC, Martin Nowak wrote: On Saturday, 2 May 2015 at 04:53:51 UTC, Jens Bauer wrote: Is it possible to write the malloc so it's garbage collector-friendly ? Garbage collection on microcontrollers doesn't make sense, because the memory consumption will

Re: compile time garbage collection

2015-05-02 Thread via Digitalmars-d
On Saturday, 2 May 2015 at 16:13:36 UTC, ketmar wrote: On Sat, 02 May 2015 15:10:10 +, Freddy wrote: How crazy hard would it be to have a front end optimization pass that would try to replace garbage collector calls with malloc / free? impossible. Not impossible, but if you can do it

Re: Closure capture loop variables

2015-05-02 Thread via Digitalmars-d
On Saturday, 2 May 2015 at 03:35:17 UTC, ketmar wrote: if js doing something, big chances are that it's wrong. Brendan failed his Scheme classes, especially those where he was taught about closures. Here's another fun thing about javascript: a = new Number(1); b = new Number(1); a=b; // true

[Issue 14476] core.thread unit tests failing on FreeBSD 9+

2015-05-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14476 --- Comment #7 from Martin Nowak c...@dawg.eu --- This is a simple stack overflow. The unittest creates a thread with the minumum stack size of 4KiB and that thread crashes when calling pthread_attr_get_np.

DTiled: Tiled map loader

2015-05-02 Thread rcorre via Digitalmars-d-announce
Any D game developers out there looking to create a tile-based game? DTiled aims to provide a quick and easy way to load maps created with Tiled (http://www.mapeditor.org). For those that don't know, Tiled is an open-source 2D tilemap editor that is a great tool for indie developers. At the

Re: DTiled: Tiled map loader

2015-05-02 Thread rcorre via Digitalmars-d-announce
hmm ... apparently copy-pasting out of a vim buffer was not a good idea. Sorry about the weird line breaks.

Re: Closure capture loop variables

2015-05-02 Thread Idan Arye via Digitalmars-d
On Friday, 1 May 2015 at 21:42:22 UTC, deadalnix wrote: On Friday, 1 May 2015 at 17:51:05 UTC, Walter Bright wrote: On 4/30/2015 5:55 AM, Vladimir Panteleev wrote: I think Freddy's programs are working as designed. Yes, they are. D closures capture variables by reference. No, we're not

[Issue 14476] core.thread unit tests failing on FreeBSD 9+

2015-05-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14476 Martin Nowak c...@dawg.eu changed: What|Removed |Added Keywords||pull --- Comment #8 from Martin

Re: DTiled: Tiled map loader

2015-05-02 Thread Namespace via Digitalmars-d-announce
On Saturday, 2 May 2015 at 19:17:51 UTC, rcorre wrote: hmm ... apparently copy-pasting out of a vim buffer was not a good idea. Sorry about the weird line breaks. Nice that you named Dgame on your repo. ;) As soon as it supports XML and CSV I would definitely use it. For my April/Mai game

Re: if(arr) now a warning

2015-05-02 Thread Andrei Alexandrescu via Digitalmars-d
On 5/2/15 4:06 AM, Vladimir Panteleev wrote: On Saturday, 2 May 2015 at 09:20:50 UTC, Jonathan M Davis wrote: The only problem I see with making the change has been a couple of very vocal folks [...] (since it's Andrei and Cybershadow who are complaining) You either die a hero, or live long

Re: if(arr) now a warning

2015-05-02 Thread Walter Bright via Digitalmars-d
On 5/2/2015 11:17 AM, deadalnix wrote: Back with some data, this change indeed discovered one bug in SDC. This was not the first one I'm aware of the confusing behavior, and looking for it in PR, still we have at least one case left. I don't doubt that the change will discover a bug here and

Re: if(arr) now a warning

2015-05-02 Thread deadalnix via Digitalmars-d
Back with some data, this change indeed discovered one bug in SDC. This was not the first one I'm aware of the confusing behavior, and looking for it in PR, still we have at least one case left.

GTA5 mods in D?

2015-05-02 Thread Israel via Digitalmars-d
I know you guys are programmers and not gamers but it thought maybe you want to experiment or help expand D? Currently there is a Script hook program that allows users to create mods/scripts for GTA5. http://www.dev-c.com/gtav/scripthookv/ Some people have made plugins for script hook to

Re: if(arr) now a warning

2015-05-02 Thread Walter Bright via Digitalmars-d
On 5/2/2015 7:37 AM, Martin Nowak wrote: On Friday, 1 May 2015 at 19:45:18 UTC, Walter Bright wrote: I suspect this kind of change and check would be appropriate for a D linter, and not be part of the core language. Yes it would fit nicely into a static analyzer, but DMD is currently the only

Re: ARM Cortex-M Microcontroller startup files

2015-05-02 Thread Johannes Pfau via Digitalmars-d
Am Sat, 02 May 2015 09:45:56 + schrieb Mike n...@none.com: On Friday, 1 May 2015 at 07:34:04 UTC, Johannes Pfau wrote: TLDR: I'd prefer using @cctor extern(C) void foo() {} instead of normal d module ctors. Bonus points: You can have more than one @cctor per module. How do

Re: What wrong?

2015-05-02 Thread Dennis Ritchie via Digitalmars-d-learn
On Saturday, 2 May 2015 at 02:51:52 UTC, Fyodor Ustinov wrote: Simple code: http://pastebin.com/raw.php?i=7jVeMFXQ This code works compiled by DMD v2.066.1 and LDC2 (0.15.1) based on DMD v2.066.1 and LLVM 3.5.0. $ ./z TUQLUE 42 11 Compiled by DMD v2.067.1 the program crashes: $ ./aa TUQLUE

Re: A slice can lose capacity simply by calling a function

2015-05-02 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, May 02, 2015 07:46:27 Ali Çehreli via Digitalmars-d-learn wrote: On 05/02/2015 01:56 AM, Jonathan M Davis via Digitalmars-d-learn wrote: I really don't think that it's reasonable in the general case to expect to be able to guarantee that the capacity of a dynamic array won't

Re: ARM Cortex-M Microcontroller startup files

2015-05-02 Thread Mike via Digitalmars-d
On Friday, 1 May 2015 at 06:57:08 UTC, Timo Sintonen wrote: I think we should omit moduleinfo totally and so we can not have module constructors. I think pointers to static constructors are available in a certain section that I have not in my link script. Adding this section should make

Re: Destruction in D

2015-05-02 Thread bitwise via Digitalmars-d-learn
On Fri, 01 May 2015 14:37:40 -0400, Idan Arye generic...@gmail.com wrote: Structs allow you to implement ref-counting smart pointers like you can do in C++. There is an implementation in the standard library: http://dlang.org/phobos/std_typecons.html#.RefCounted Yeah, I guess I should have

Re: GTA5 mods in D?

2015-05-02 Thread w0rp via Digitalmars-d
On Saturday, 2 May 2015 at 18:51:53 UTC, Israel wrote: I know you guys are programmers and not gamers but it thought maybe you want to experiment or help expand D? Currently there is a Script hook program that allows users to create mods/scripts for GTA5.

Re: Reading bzipped files

2015-05-02 Thread tom via Digitalmars-d-learn
On Saturday, 2 May 2015 at 13:50:10 UTC, Per Nordlöw wrote: Have anybody cooked up any range adaptors for on the fly decoding of bzipped files? Preferable compatible with phobos standard interfaces for file io. Should probably be built on top of http://code.dlang.org/packages/bzip2 i use

Re: if(arr) now a warning

2015-05-02 Thread Walter Bright via Digitalmars-d
On 5/2/2015 4:06 AM, Vladimir Panteleev wrote: On Saturday, 2 May 2015 at 09:20:50 UTC, Jonathan M Davis wrote: The only problem I see with making the change has been a couple of very vocal folks [...] (since it's Andrei and Cybershadow who are complaining) You either die a hero, or live long

Re: What wrong?

2015-05-02 Thread Dennis Ritchie via Digitalmars-d-learn
On Saturday, 2 May 2015 at 19:38:01 UTC, Fyodor Ustinov wrote: I see it by the lack of 42. :) But why is this receive breaks down? Report, please, about it (D)evepopers :) https://issues.dlang.org/

Re: ARM Cortex-M Microcontroller startup files

2015-05-02 Thread Martin Nowak via Digitalmars-d
On Saturday, 2 May 2015 at 15:15:50 UTC, Jens Bauer wrote: Will it be possible to have associative arrays without garbage collection ? You can write an AA container. A RefCounted AA implementation might allow unsafe escaping though. What about dynamic strings and dynamic arrays, don't they

Re: [your code here] Rounding real numbers

2015-05-02 Thread Andrei Alexandrescu via Digitalmars-d
On Friday, 1 May 2015 at 17:17:09 UTC, Justin Whear wrote: A process for rounding numbers. Thanks Justin. Could someone take this? We don't have PHP code for rotating examples randomly yet. -- Andrei

The hackathon week roundup

2015-05-02 Thread Andrei Alexandrescu via Digitalmars-d
The hackathon week (Apr 25 - May 1) saw 70 PRs created (compare to 68 created Apr 18 through 24). Not much difference in terms of new work, but the PRs closed during the same two periods (75 vs 53) reflect a good bump in the reviewing activity. Another related data point: 143 PRs were updated

The hackathon week roundup

2015-05-02 Thread Andrei Alexandrescu via Digitalmars-d-announce
The hackathon week (Apr 25 - May 1) saw 70 PRs created (compare to 68 created Apr 18 through 24). Not much difference in terms of new work, but the PRs closed during the same two periods (75 vs 53) reflect a good bump in the reviewing activity. Another related data point: 143 PRs were updated

Re: The hackathon week roundup

2015-05-02 Thread weaselcat via Digitalmars-d
On Saturday, 2 May 2015 at 23:02:05 UTC, Andrei Alexandrescu wrote: * WIP: Unique https://github.com/D-Programming-Language/phobos/pull/3225 and RefCounted (can't seem to find the PR - where is it?) already got pulled https://github.com/D-Programming-Language/phobos/pull/3171 Worth adding:

Re: The hackathon week roundup

2015-05-02 Thread weaselcat via Digitalmars-d-announce
On Saturday, 2 May 2015 at 23:02:05 UTC, Andrei Alexandrescu wrote: * WIP: Unique https://github.com/D-Programming-Language/phobos/pull/3225 and RefCounted (can't seem to find the PR - where is it?) already got pulled https://github.com/D-Programming-Language/phobos/pull/3171 Worth adding:

Re: stdx.data.json - enhancement suggestions

2015-05-02 Thread Ilya Yaroshenko via Digitalmars-d-learn
You can use std.json or create TrustedInputRangeShell template with @trasted methods: struct TrustedInputRangeShell(Range) { Range* data; auto front() @property @trusted { return (*data).front; } //etc } But I am not sure about other parseJSONStream bugs.

Re: The hackathon week roundup

2015-05-02 Thread Ilya Yaroshenko via Digitalmars-d-announce
* Tutorial: http://d.readthedocs.org (btw should we link that from the homepage?) May I transfer the repositories (both GitHub and RTD) to the D-Programming-Language community?

How to I translate this C++ structure/array

2015-05-02 Thread WhatMeWorry via Digitalmars-d-learn
This is probably trivial but I just can't make a break thru. I've got C++ code using glm like so: struct Vertex { glm::vec3 position; glm::vec3 color; } Vertex triangle[] = [ glm::vec3(0.0, 1.0, 0.0), glm::vec3(1.0, 0.0, 0.0), // red

why std.process.Pid std.process.Environment are classes ?

2015-05-02 Thread Baz via Digitalmars-d-learn
In std.process, the following declarations: - final class Pid - abstract final class environment could be struct, couldn't they ? Any particular reason behind this choice ?

Re: How to I translate this C++ structure/array

2015-05-02 Thread anonymous via Digitalmars-d-learn
On Saturday, 2 May 2015 at 22:01:10 UTC, WhatMeWorry wrote: struct Vertex { vec3 position; vec3 color; } Vertex triangle[6] = [ vec3(0.0, 1.0, 0.0), vec3(1.0, 0.0, 0.0), // red // code removed for brevity. ]; I keep getting

Re: compile time garbage collection

2015-05-02 Thread ketmar via Digitalmars-d
On Sat, 02 May 2015 16:24:15 +, Ola Fosheim Grøstad wrote: On Saturday, 2 May 2015 at 16:13:36 UTC, ketmar wrote: On Sat, 02 May 2015 15:10:10 +, Freddy wrote: How crazy hard would it be to have a front end optimization pass that would try to replace garbage collector calls with

[Issue 14508] compiling with -unittest instantiates templates in non-root modules

2015-05-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14508 Kenji Hara k.hara...@gmail.com changed: What|Removed |Added Keywords||pull --- Comment #2 from

Re: compile time garbage collection

2015-05-02 Thread weaselcat via Digitalmars-d
On Saturday, 2 May 2015 at 16:24:17 UTC, Ola Fosheim Grøstad wrote: Not impossible, but if you can do it you probably often can replace it with a stack allocation. AFAIK LDC already has a pass that does this, I'm not sure how well it works.

Re: if(arr) now a warning

2015-05-02 Thread ketmar via Digitalmars-d
On Sat, 02 May 2015 19:56:49 +, weaselcat wrote: On Saturday, 2 May 2015 at 14:37:08 UTC, Martin Nowak wrote: On Friday, 1 May 2015 at 19:45:18 UTC, Walter Bright wrote: I suspect this kind of change and check would be appropriate for a D linter, and not be part of the core language.

Re: compile time garbage collection

2015-05-02 Thread ketmar via Digitalmars-d
On Sun, 03 May 2015 04:40:42 +, weaselcat wrote: On Saturday, 2 May 2015 at 16:24:17 UTC, Ola Fosheim Grøstad wrote: Not impossible, but if you can do it you probably often can replace it with a stack allocation. AFAIK LDC already has a pass that does this, I'm not sure how well it

Re: compile time garbage collection

2015-05-02 Thread deadalnix via Digitalmars-d
On Sunday, 3 May 2015 at 04:40:44 UTC, weaselcat wrote: On Saturday, 2 May 2015 at 16:24:17 UTC, Ola Fosheim Grøstad wrote: Not impossible, but if you can do it you probably often can replace it with a stack allocation. AFAIK LDC already has a pass that does this, I'm not sure how well it

Re: The most awesome forward to member solution?

2015-05-02 Thread Meta via Digitalmars-d
On Sunday, 3 May 2015 at 04:20:46 UTC, Andrei Alexandrescu wrote: On 5/2/15 5:42 PM, Meta wrote: On Sunday, 3 May 2015 at 00:25:13 UTC, Dicebot wrote: Here's what I have right now - simple as they come: http://dpaste.dzfl.pl/7ec11459a125. Kudos to whoever defined ParameterTypeTuple, it's

Parameter storage class 'in' transitive like 'const'?

2015-05-02 Thread Ali Çehreli via Digitalmars-d-learn
We know that 'in' is equivalent to const scope: http://dlang.org/function.html#parameters So, the constness of 'in' is transitive as well, right? Ali

Re: The most awesome forward to member solution?

2015-05-02 Thread Andrei Alexandrescu via Digitalmars-d
On 5/2/15 10:00 PM, Meta wrote: It seems like it'd be a lot cheaper and cleaner to just be able to alias the parent method. Yeh, that's the first solution that comes to mind. alias doesn't work here but of course we could change the language. Also, it could probably be made a bit simpler

Re: What wrong?

2015-05-02 Thread Fyodor Ustinov via Digitalmars-d-learn
On Saturday, 2 May 2015 at 19:13:45 UTC, Dennis Ritchie wrote: On Saturday, 2 May 2015 at 02:51:52 UTC, Fyodor Ustinov wrote: Simple code: http://pastebin.com/raw.php?i=7jVeMFXQ This code works compiled by DMD v2.066.1 and LDC2 (0.15.1) based on DMD v2.066.1 and LLVM 3.5.0. $ ./z TUQLUE 42

Re: if(arr) now a warning

2015-05-02 Thread weaselcat via Digitalmars-d
On Saturday, 2 May 2015 at 14:37:08 UTC, Martin Nowak wrote: On Friday, 1 May 2015 at 19:45:18 UTC, Walter Bright wrote: I suspect this kind of change and check would be appropriate for a D linter, and not be part of the core language. Yes it would fit nicely into a static analyzer, but DMD

Re: Quick Start with D: few examples and set of links.

2015-05-02 Thread rom via Digitalmars-d-announce
Congratulations on that web site : trendy stripped down and efficient style, greatly instructive and easy to read for the new comers. That's what i think the D language misses the most, if i may. Rom On Friday, 1 May 2015 at 08:18:10 UTC, Ilya Yaroshenko wrote: http://d.readthedocs.org I

Re: The hackathon week roundup

2015-05-02 Thread Ilya Yaroshenko via Digitalmars-d
* Tutorial: http://d.readthedocs.org (btw should we link that from the homepage?) May I transfer the repositories (both GitHub and RTD) to the D-Programming-Language community?

The most awesome forward to member solution?

2015-05-02 Thread Andrei Alexandrescu via Digitalmars-d
Hey folks, So in working with the allocator, a common matter has come again to the fore: I need to forward certain functions to a member. Consider code in https://github.com/andralex/phobos/blob/allocator/std/experimental/allocator/free_tree.d: struct FreeTree(ParentAllocator) { ...

Re: The most awesome forward to member solution?

2015-05-02 Thread Dicebot via Digitalmars-d
Sounds similar to http://dlang.org/phobos/std_typecons.html#.Proxy

Re: The most awesome forward to member solution?

2015-05-02 Thread Meta via Digitalmars-d
On Sunday, 3 May 2015 at 00:25:13 UTC, Dicebot wrote: Sounds similar to http://dlang.org/phobos/std_typecons.html#.Proxy That's a good idea. Proxy could be improved to take a list of names of members to forward. That'd be pretty cool actually.

  1   2   >