Re: Problem overloading operator for a struct with an immutable member

2015-03-26 Thread Nicolas Sicard via Digitalmars-d-learn
On Thursday, 26 March 2015 at 04:57:55 UTC, ketmar wrote: by the way. do you know that you still CAN overload postincrement operation? yes, the code is still here, and it works... somethimes. ;-) Thnaks. Indeed, this works: --- struct S { int i; immutable(Object) o; void

Problem overloading operator for a struct with an immutable member

2015-03-24 Thread Nicolas Sicard via Digitalmars-d-learn
I don't know if this is a bug or expected behaviour. The struct is mutable, assignable and pre-increment operator works. But post-increment doesn't compile because of the immutable member. -- struct S { int i; immutable(Object) o; S opUnary(string op)() { return this; } void

Re: A few notes on choosing between Go and D for a quick project

2015-03-15 Thread Nicolas Sicard via Digitalmars-d
On Sunday, 15 March 2015 at 14:01:00 UTC, bearophile wrote: Walter Bright: I'd also prefer to get rid of /+ +/ comments, I thought they'd be more useful than they are. I prefer to get rid of /* */ instead :-) Because /++/ can do things /**/ can't. +1 And on my keyboard, /++/ is easier

Re: Testing implicit conversion to template instance with is() expression

2015-03-15 Thread Nicolas Sicard via Digitalmars-d-learn
On Sunday, 15 March 2015 at 18:33:32 UTC, Marc Schütz wrote: On Sunday, 15 March 2015 at 17:03:42 UTC, Marc Schütz wrote: https://issues.dlang.org/show_bug.cgi?id=14286 In the meantime, does someone know of a suitable workaround? I found the following workaround. Not beautiful, but it works:

Re: enum and static if

2015-03-11 Thread Nicolas Sicard via Digitalmars-d-learn
On Wednesday, 11 March 2015 at 17:19:20 UTC, ketmar wrote: On Wed, 11 Mar 2015 18:17:38 +0100, Artur Skawina via Digitalmars-d-learn wrote: On 03/11/15 15:41, ketmar via Digitalmars-d-learn wrote: On Wed, 11 Mar 2015 14:36:07 +, wobbles wrote: On Wednesday, 11 March 2015 at 14:34:32

Re: Int to float?

2015-03-06 Thread Nicolas Sicard via Digitalmars-d-learn
On Friday, 6 March 2015 at 00:57:16 UTC, Ola Fosheim Grøstad wrote: On Thursday, 5 March 2015 at 23:50:28 UTC, Jesse Phillips wrote: I think I read somewhere you don't want to use unions like this, but I think it is more because you generally don't want to reinterpret bits. It is

Showcase your favorite language on Codegolf SE

2015-01-21 Thread Nicolas Sicard via Digitalmars-d
In case nobody has noticed it yet, there's an interesting new challenge on codegolf.stackexchange called Showcase your language where you can only show a snippet of length equal to your number of upvotes (more detailed rule there).

Re: SQLLite driver

2014-12-14 Thread Nicolas Sicard via Digitalmars-d-learn
On Sunday, 14 December 2014 at 13:47:21 UTC, Suliman wrote: On Sunday, 14 December 2014 at 13:33:27 UTC, Suliman wrote: There is also a branch named `develop` which at least compiles, maybe it is usable. how to add to dub this branch? Compiling using dmd... Linking... OPTLINK (R) for Win32

Re: Delegates and C function pointers

2014-11-08 Thread Nicolas Sicard via Digitalmars-d-learn
On Saturday, 8 November 2014 at 16:01:09 UTC, anonymous wrote: On Saturday, 8 November 2014 at 12:23:45 UTC, Nicolas Sicard wrote: I would like to register a D delegate to a C API that takes a function pointer as a callback and a void* pointer to pass data to this callback. My solution

Re: module keyword with curly brackets

2014-11-01 Thread Nicolas Sicard via Digitalmars-d
On Saturday, 1 November 2014 at 10:32:48 UTC, Jonathan M Davis via Digitalmars-d wrote: On Saturday, November 01, 2014 07:52:38 tcak via Digitalmars-d wrote: The module declaration, and the name and path of D files do not need to match each other. You include a D file while compiling the

Re: module keyword with curly brackets

2014-11-01 Thread Nicolas Sicard via Digitalmars-d
On Saturday, 1 November 2014 at 14:40:16 UTC, Dicebot wrote: On Saturday, 1 November 2014 at 14:03:51 UTC, Nicolas Sicard wrote: What's the reason why the module keyword was introduced in the first place? The package and module hierarchy could have been deduced from the directory and file

Re: module keyword with curly brackets

2014-11-01 Thread Nicolas Sicard via Digitalmars-d
On Saturday, 1 November 2014 at 15:32:22 UTC, Dicebot wrote: On Saturday, 1 November 2014 at 14:48:33 UTC, Nicolas Sicard wrote: On Saturday, 1 November 2014 at 14:40:16 UTC, Dicebot wrote: On Saturday, 1 November 2014 at 14:03:51 UTC, Nicolas Sicard wrote: What's the reason why the module

Re: struct and default constructor

2014-10-11 Thread Nicolas Sicard via Digitalmars-d
On Friday, 10 October 2014 at 22:34:45 UTC, ketmar via Digitalmars-d wrote: I think I like the idea of the factory method now though, as I've learned you can hide a struct inside a function, and then call the function to set the struct up properly and return it. At least, I'm sure I've seen

Re: Trouble with std.Variant

2014-09-19 Thread Nicolas Sicard via Digitalmars-d-learn
On Thursday, 18 September 2014 at 21:14:55 UTC, Ali Çehreli wrote: On 09/18/2014 02:06 PM, ddos wrote: The following code fails because Vec2.length() does not return int ... so Variant is only usable with types that do not have a method with name length() ?? i'm confused On Thursday, 18

Re: long double in C APIs

2014-09-16 Thread Nicolas Sicard via Digitalmars-d
On Monday, 15 September 2014 at 23:20:45 UTC, Walter Bright wrote: On 9/15/2014 3:24 PM, David Nadlinger wrote: 2. It effectively forces everybody to make all conversions to long double explicit in their code, This is due to D currently not allowing implicit conversion to a struct. It's a

Re: Integral literals with Exp?

2014-09-15 Thread Nicolas Sicard via Digitalmars-d
On Monday, 15 September 2014 at 09:19:12 UTC, eles wrote: On Monday, 15 September 2014 at 09:13:52 UTC, Walter Bright wrote: On 9/15/2014 1:54 AM, John Colvin wrote: On Monday, 15 September 2014 at 00:54:40 UTC, Walter Bright wrote: On 9/13/2014 12:23 AM, bearophile wrote: Readability is

Re: Convert hexadecimal to decimal

2014-08-25 Thread Nicolas Sicard via Digitalmars-d
On Monday, 25 August 2014 at 06:57:48 UTC, confused wrote: hi team! I'm using this swift piece of code to seek out the Option 26 DHCP is deploying and output to the screen: https://github.com/CyberShadow/dhcptest/blob/master/dhcptest.d (props for code CyberShadow). When I get the value it

Re: Convert hexadecimal to decimal

2014-08-25 Thread Nicolas Sicard via Digitalmars-d
On Monday, 25 August 2014 at 07:37:59 UTC, hane wrote: On Monday, 25 August 2014 at 06:57:48 UTC, confused wrote: hi team! I'm using this swift piece of code to seek out the Option 26 DHCP is deploying and output to the screen: https://github.com/CyberShadow/dhcptest/blob/master/dhcptest.d

Re: mixin assembler does not work?

2014-07-21 Thread Nicolas Sicard via Digitalmars-d-learn
On Sunday, 20 July 2014 at 15:02:58 UTC, Foo wrote: On Sunday, 20 July 2014 at 14:55:00 UTC, Foo wrote: For clarification: how would that work without mixin + string? I tried this: mixin template Vala2(uint count, alias arr) { asm { sub ESP, count; mov

Re: ddox-generated Phobos documentation is available for review

2014-03-10 Thread Nicolas Sicard
On Monday, 10 March 2014 at 03:44:54 UTC, Andrei Alexandrescu wrote: Consider it alpha quality. Please don't announce yet before we put it in good shape. https://github.com/D-Programming-Language/dlang.org/pull/516 http://dlang.org/library http://dlang.org/library-prerelease I needed to

Re: xvalue and std::move in D

2014-03-06 Thread Nicolas Sicard
On Thursday, 6 March 2014 at 11:49:51 UTC, Edwin van Leeuwen wrote: On Thursday, 6 March 2014 at 11:28:21 UTC, Mike Parker wrote: See std.algorithm.move Thank you, can't believe I missed that. How do I specify that the function expects a temporary/xvalue () parameter though? What are you

Re: RFC: Units of measurement for D (Phobos?)

2014-03-04 Thread Nicolas Sicard
On Wednesday, 26 February 2014 at 22:49:57 UTC, Nordlöw wrote: On Wednesday, 26 February 2014 at 21:41:57 UTC, Kelet wrote: Tangentially related: https://github.com/biozic/quantities Impressive! This seems similar to David Nadlingers std.units and std.si. When will all these efforts on

Re: RFC: Units of measurement for D (Phobos?)

2014-03-04 Thread Nicolas Sicard
On Tuesday, 4 March 2014 at 13:20:02 UTC, Nordlöw wrote: Thanks! I think David Nadlingers' is more elaborate (scaled and affine units) and less prone to rounding errors. I haven't used it yet. Mine is more basic but has a parsing system that I use to So you cannot defined things lika kPa from

Re: adding static return?

2014-03-04 Thread Nicolas Sicard
On Monday, 3 March 2014 at 23:27:42 UTC, Xavier Bigand wrote: I thought it could be nice to have a static return. My Idea is to remove unnecessary bracket encapsulation made with some static if statements. It will works like this : module xxx.opengl; import buildSettings; // contains some

Re: Top-3 for 2.066

2014-02-25 Thread Nicolas Sicard
On Tuesday, 25 February 2014 at 05:01:30 UTC, Manu wrote: In lieu of a clear roadmap, I'm just going to list the things actively holding me up on a daily basis. Others encouraged to add theirs, maybe we'll see patterns emerge. What are yours? Enhanced privacy:

Re: How to resume iteration from previous point in associative array

2014-02-19 Thread Nicolas Sicard
On Wednesday, 19 February 2014 at 09:28:27 UTC, bearophile wrote: Tarman: We're doing some super computing big data style stuff with D. We have a system where we're comparing associative arrays with billions of entries. Built-in associative arrays were never tested with so many pairs, so

Re: Review Candidates awaited!

2014-02-15 Thread Nicolas Sicard
On Saturday, 1 February 2014 at 19:52:59 UTC, Dicebot wrote: Looking at http://wiki.dlang.org/Review_Queue there are 4 proposals that are marked as Ready for review or Ready for comments. I can proceed with any of those any time proposal author sends me an e-mail acknowledging his attention.

Re: D as A Better C?

2014-02-12 Thread Nicolas Sicard
On Tuesday, 11 February 2014 at 21:19:36 UTC, Walter Bright wrote: On 2/11/2014 1:00 PM, Brian Rogoff wrote: Which D metaprogramming (templates, mixins, ctfe, ..) features would be in this D subset? All of them. And would all of D features be available at compile time? CTFE/string mixins

It works!

2014-01-27 Thread Nicolas Sicard
The URL http://dlang.org links to a page that just says It works! So laconic a statement for such a wonderful language! ;-) Nicolas

Re: It works!

2014-01-27 Thread Nicolas Sicard
On Monday, 27 January 2014 at 12:40:12 UTC, Sönke Ludwig wrote: Am 27.01.2014 13:34, schrieb Nicolas Sicard: The URL http://dlang.org links to a page that just says It works! So laconic a statement for such a wonderful language! ;-) Nicolas Looks fine from here. Strange. I'll try again

Re: It works!

2014-01-27 Thread Nicolas Sicard
On Monday, 27 January 2014 at 17:55:35 UTC, Brad Roberts wrote: On 1/27/14 9:43 AM, Stanislav Blinov wrote: On Monday, 27 January 2014 at 16:11:56 UTC, Andrei Alexandrescu wrote: Sure you meant http://issues.dlang.org/ That one is even more desriptive :) Issues.dlang.org isn't expected

Re: Using a delegate stored as a member of a destroyed struct?

2014-01-27 Thread Nicolas Sicard
On Monday, 27 January 2014 at 02:27:08 UTC, Steven Schveighoffer wrote: On Sun, 26 Jan 2014 18:41:00 -0500, Nicolas Sicard dran...@gmail.com wrote: Running a piece of code that can be reduced to: --- import std.stdio; void main() { import std.range; foreach(item; iota(0, 10

Re: Using a delegate stored as a member of a destroyed struct?

2014-01-27 Thread Nicolas Sicard
On Monday, 27 January 2014 at 14:47:21 UTC, Steven Schveighoffer wrote: On Mon, 27 Jan 2014 03:17:51 -0500, Nicolas Sicard dran...@gmail.com wrote: Actually I used a struct because the code is more complex, and it builds an array of delegates, which are returned from global functions, like

Using a delegate stored as a member of a destroyed struct?

2014-01-26 Thread Nicolas Sicard
Running a piece of code that can be reduced to: --- import std.stdio; void main() { import std.range; foreach(item; iota(0, 10).transform(2)) writeln(item); } auto transform(T)(T list, real x) { auto t = /* new */ Transformer(x); // line 12

Conflict with private symbol from an imported module

2014-01-23 Thread Nicolas Sicard
Hi, I known this has been discussed before, and there still is an open issue in bugzilla (https://d.puremagic.com/issues/show_bug.cgi?id=1238). Is it considered a feature or a bug? Thanks

Re: Conflict with private symbol from an imported module

2014-01-23 Thread Nicolas Sicard
On Thursday, 23 January 2014 at 17:29:08 UTC, Gary Willoughby wrote: On Thursday, 23 January 2014 at 17:06:17 UTC, Nicolas Sicard wrote: Hi, I known this has been discussed before, and there still is an open issue in bugzilla (https://d.puremagic.com/issues/show_bug.cgi?id=1238

Re: alias have new syntax?

2014-01-19 Thread Nicolas Sicard
On Saturday, 18 January 2014 at 23:00:11 UTC, bearophile wrote: cmplx: During the study D, I stumbled upon this design alias myInt = int; but the specification says nothing about such use alias. Is the syntax has been changed? Yes, it's a recent very small syntax improvement. Eventually I

Re: Non-null objects, the Null Object pattern, and T.init

2014-01-19 Thread Nicolas Sicard
On Saturday, 18 January 2014 at 22:12:09 UTC, bearophile wrote: Walter Bright: I don't think a new syntax is required. We already have the template syntax: RangedInt!(0,10) should do it. Is this array literal accepted, and can D spot the out-of-range bug at compile time (Ada language

Re: Tyepof regex

2014-01-13 Thread Nicolas Sicard
On Monday, 13 January 2014 at 20:59:28 UTC, Brad Anderson wrote: There is also std.traits.ReturnType you can use for more complex types or voldemort types. Or: typeof(regex()) BTW, how does ReturnType handle overloads? -- Nicolas

Re: Temple: Compile time, embedded D templates

2014-01-03 Thread Nicolas Sicard
On Thursday, 2 January 2014 at 08:36:24 UTC, Dylan Knutson wrote: The reason for this is that std.variant.Variant isn't CTFEable, because it uses memcpy in opAssign. I'd consider that a Phobos bug; perhaps there is a way to make std.variant CTFE compatible? That'd allow for a much wider (and

Re: static if - is the 'static' really needed?

2013-12-13 Thread Nicolas Sicard
On Friday, 13 December 2013 at 12:10:02 UTC, comco wrote: Imagine a world in which a simple 'if' has the semantics of a static if, if the condition is evaluable at CT. Is this a world you would rather live in? template Fac(int i) { if (i == 0) { // static if; doesn't introduce scope enum Fac

Re: is there anything like a DUB manual?

2013-12-07 Thread Nicolas Sicard
On Saturday, 7 December 2013 at 19:59:50 UTC, Fra wrote: I finally decided to try out DUB. The simple examples work great, but I could not find any user guide/list of possible options to be put in the package.json file. Just as an example, how do you pass specific compiler flags like '-J'?

Re: Shall I use std.json at my own risks ?

2013-11-12 Thread Nicolas Sicard
On Wednesday, 13 November 2013 at 06:30:21 UTC, Jonathan M Davis wrote: On Tuesday, November 12, 2013 22:11:45 H. S. Teoh wrote: What's the reason vibe.d's json tools aren't backported to Phobos? Probably because no one has ever bothered to try and get them ready to be reviewed for inclusion

__gshared immutable array of immutable elements

2013-11-12 Thread Nicolas Sicard
In this declaration (tango.io.Console.d from Tango2): __gshared immutable immutable(char)[] Eol = \r\n; Aren't the two `immutable` keywords redundant? Why would `__gshared` be necessary for such an immutable type? Thanks

Re: __gshared immutable array of immutable elements

2013-11-12 Thread Nicolas Sicard
On Tuesday, 12 November 2013 at 20:16:31 UTC, Dicebot wrote: On Tuesday, 12 November 2013 at 20:09:57 UTC, Martin Drašar wrote: Those two immutables are not redundant, because it is an array of immutable chars (string), that is itself immutable. It is redundant because immutable is

Re: How to iterate using foreach on a class?

2013-11-03 Thread Nicolas Sicard
On Friday, 1 November 2013 at 12:37:20 UTC, simendsjo wrote: On Friday, 1 November 2013 at 11:41:52 UTC, Jonathan M Davis wrote: On Friday, November 01, 2013 12:30:10 Gary Willoughby wrote: I have a class which contains an array as a core collection of data. I want to pass an instance of this

Re: DMD 2.064 changelog typo?

2013-10-29 Thread Nicolas Sicard
On Tuesday, 29 October 2013 at 20:56:02 UTC, monarch_dodra wrote: On Tuesday, 29 October 2013 at 10:08:00 UTC, Sergei Nosov wrote: I guess it's a good thing, it's available online. While looking through it, I also noticed that there are new functions 'stripLeft/stripRight'. I believe it would

Re: How to get a substring?

2013-10-27 Thread Nicolas Sicard
On Sunday, 27 October 2013 at 03:45:50 UTC, Timothee Cour wrote: On Sat, Oct 26, 2013 at 6:24 PM, Nicolas Sicard dran...@gmail.com wrote: On Sunday, 27 October 2013 at 00:18:41 UTC, Timothee Cour wrote: I've posted a while back a string=string substring function that doesn't allocating

Re: How to get a substring?

2013-10-27 Thread Nicolas Sicard
On Sunday, 27 October 2013 at 07:44:06 UTC, Jakob Ovrum wrote: On Saturday, 26 October 2013 at 21:23:13 UTC, Gautam Goel wrote: Dumb Newbie Question: I've searched through the library reference, but I haven't figured out how to extract a substring from a string. I'd like something like

Re: wrap/unwrap vs Go-style duck typing

2013-10-26 Thread Nicolas Sicard
On Saturday, 26 October 2013 at 14:39:31 UTC, Martin Nowak wrote: On 10/25/2013 07:46 AM, Andrei Alexandrescu wrote: Hello, I was curious how our fledgling wrap and unwrap routines compare with Go's duck typing - similarities, distinctions, performance. Please share any thoughts, thanks!

Re: wrap/unwrap vs Go-style duck typing

2013-10-26 Thread Nicolas Sicard
On Saturday, 26 October 2013 at 15:08:23 UTC, Andrei Alexandrescu wrote: On 10/26/13 7:55 AM, Nicolas Sicard wrote: On Saturday, 26 October 2013 at 14:39:31 UTC, Martin Nowak wrote: On 10/25/2013 07:46 AM, Andrei Alexandrescu wrote: Hello, I was curious how our fledgling wrap and unwrap

Re: How to get a substring?

2013-10-26 Thread Nicolas Sicard
On Sunday, 27 October 2013 at 00:18:41 UTC, Timothee Cour wrote: I've posted a while back a string=string substring function that doesn't allocating: google nonallocating unicode string manipulations code: auto slice(T)(T a,size_t u, size_t v)if(is(T==string)){//TODO:generalize to

Re: template definitions spanning modules.

2013-08-27 Thread Nicolas Sicard
On Monday, 26 August 2013 at 00:46:50 UTC, Jason den Dulk wrote: Hi Consider the following code module A; void xx(T:int)(T t) { .. } void xx(T:float)(T t) { .. } module B; import A; void xx(T:string)(T t) { .. } void main() { xx!(int)(4); xx(4.5); xx(abc); } The compiler won't let

Re: how to get enclosing function as symbol ? (eg: __function__.stringof ==__FUNCTION__)

2013-08-18 Thread Nicolas Sicard
On Sunday, 18 August 2013 at 02:50:32 UTC, JS wrote: On Sunday, 18 August 2013 at 01:52:50 UTC, Timothee Cour wrote: Is there any way to get the enclosing function as symbol ? I'd like something like that: alternative names would be: __function__ __context__ auto fun(alias

Re: Virtual templates members

2013-08-08 Thread Nicolas Sicard
On Thursday, 8 August 2013 at 01:48:49 UTC, JS wrote: The following code is used to reduce dependence on new and the GC. iNew is used as the replacement. The problem is, where ever New is used, it requires typing the type twice. e.g., A.New!A(...) instead of A.New(...) Is there any way

Re: Virtual templates members

2013-08-08 Thread Nicolas Sicard
On Thursday, 8 August 2013 at 16:58:37 UTC, JS wrote: On Thursday, 8 August 2013 at 07:21:19 UTC, Nicolas Sicard wrote: On Thursday, 8 August 2013 at 01:48:49 UTC, JS wrote: The following code is used to reduce dependence on new and the GC. iNew is used as the replacement. The problem

Re: [:] as empty associative array literal, plus warning for null

2013-07-05 Thread Nicolas Sicard
On Thursday, 4 July 2013 at 23:52:35 UTC, bearophile wrote: Andrei Alexandrescu: Where does the whole stronger typing comes in? This is poppycock. We need real arguments here. Maybe it's a matter of definitions, for me having null as literal for empty array, null pointer, empty associative

Re: Notes from C++ static analysis

2013-06-27 Thread Nicolas Sicard
On Wednesday, 26 June 2013 at 20:50:03 UTC, bearophile wrote: If you want a special behavour you should use a special function as partialWritefln that ignores arguments not present in the format string. Or maybe just define a new format specifier (%z, for 'zap'?) to ignore one or more

Re: @property - take it behind the woodshed and shoot it?

2013-01-26 Thread Nicolas Sicard
On Saturday, 26 January 2013 at 13:21:37 UTC, Jacob Carlborg wrote: It's always possible to avoid keywords in favor of syntax. Example: Declaring a getter: int foo {} Just as a regular function declaration but without the parentheses. Declaring a setter: void foo= (int value) {}

Re: PDF spec

2013-01-25 Thread Nicolas Sicard
On Thursday, 24 January 2013 at 06:26:13 UTC, Andrei Alexandrescu wrote: There's quite a bit of work left to do, but the PDF spec already has 386 pages of goodness and starts to look seriously cool. Take a peek! http://dlang.org/dlangspec.pdf (still subject to

Re: D for scientific computing

2013-01-24 Thread Nicolas Sicard
On Wednesday, 23 January 2013 at 22:39:04 UTC, Alan wrote: I saw an old thread from 2004 while doing a google search that discussed D and scientific computing and was looking for some more recent information or opinions from people who have used it for such purposes. I am a graduate student

Re: D for scientific computing

2013-01-24 Thread Nicolas Sicard
On Thursday, 24 January 2013 at 10:42:10 UTC, Joseph Rushton Wakeling wrote: On 01/24/2013 11:16 AM, Walter Bright wrote: If you use the 64 bit model, dmd will use SIMD instructions for float and double, which are much faster. I generally find that dmd-compiled programs run at about half

Re: Limited printing?

2013-01-16 Thread Nicolas Sicard
On Wednesday, 16 January 2013 at 11:16:41 UTC, bearophile wrote: In Mathematica and NumPy (and other systems used with REPL) if you print a very large array you receive a shortened output. In Mathematica: http://reference.wolfram.com/mathematica/tutorial/ShortAndShallowOutput.html

Re: Limited printing?

2013-01-16 Thread Nicolas Sicard
On Wednesday, 16 January 2013 at 11:46:10 UTC, bearophile wrote: Nicolas Sicard: writeln(iota(10_000).take(10)); ? You have missed the point. What if you have a [iota(10_000), iota(10_000)]? OK, but is there a simple and general way to tell how to skip elements for ranges other than

Re: Limited printing?

2013-01-16 Thread Nicolas Sicard
On Wednesday, 16 January 2013 at 14:05:03 UTC, bearophile wrote: Mathematica and NumPy on default shorten the output if it's too much large, and show it all on request. What I forgot to say in my first post is that in D it's probably better to have those conditions swapped, this means printing

Re: Mixin Template: cannot mixin scope(exit)?

2013-01-15 Thread Nicolas Sicard
On Monday, 14 January 2013 at 06:26:33 UTC, 1100110 wrote: On 01/13/2013 11:35 PM, 1100110 wrote: Ok, I wish to create a standard timing system so that I can measure ~how long each function takes to execute. I wish to be able to place at the start of a function version(Time) mixin

Re: Mixin Template: cannot mixin scope(exit)?

2013-01-15 Thread Nicolas Sicard
On Tuesday, 15 January 2013 at 11:19:50 UTC, mist wrote: I thought template itself should compile but its statement-like instantiation should not. The template shouldn't compile: the D grammar says that mixin templates inject declarations only. Hence the text of the error. By the way, if

Re: POD

2013-01-14 Thread Nicolas Sicard
On Saturday, 29 December 2012 at 01:53:15 UTC, David Nadlinger wrote: - There are also possible performance implications: Structs that just wrap a single field in order to enrich it with type information, such as Duration or a Quantity struct from a units of measurement library, will likely

Re: POD

2013-01-14 Thread Nicolas Sicard
On Monday, 14 January 2013 at 21:18:13 UTC, Walter Bright wrote: On 1/14/2013 11:24 AM, Nicolas Sicard wrote: I had started but never finished such a wrapping struct for units, and I gave it another try recently (https://github.com/biozic/siunits). Clearly, when using POD structs, the code

Re: Official DMD compiler written in D

2013-01-08 Thread Nicolas Sicard
On Tuesday, 8 January 2013 at 21:57:17 UTC, H. S. Teoh wrote: On Tue, Jan 08, 2013 at 07:48:58PM +0100, Tim Krimm wrote: Now that D 2.0 is fairly stable, are there any plans of writing the official DMD compiler with the D 2.0 language vs the present language of C++? DMD 2.0 would have to be

Re: dlangspec.pdf?

2013-01-05 Thread Nicolas Sicard
On Saturday, 5 January 2013 at 08:59:32 UTC, Philippe Sigaud wrote: From markdown, it can easily be translated into pdf, html, mobi or epub (heck, even docx) Philippe I was wondering: do you use Pandoc to do that (e.g. for your D-template tutorial)? Nicolas

Re: dlangspec.pdf?

2013-01-05 Thread Nicolas Sicard
On Saturday, 5 January 2013 at 14:10:38 UTC, Philippe Sigaud wrote: Don't tempt me. I'm playing with the idea of writing a Ddoc - Markdown converter. Something like Pandoc, but lighter. Couldn't a .ddoc file with redefined macros produce Markdown output?

Re: Parsing error

2012-12-28 Thread Nicolas Sicard
On Friday, 28 December 2012 at 08:46:22 UTC, Jonathan M Davis wrote: On Wednesday, December 26, 2012 14:08:37 Nicolas Sicard wrote: I'm not sure whether this has been reported: --- struct Foo { void bar(T)() {} void baz() {} } void main() { Foo foo; (foo).bar

Re: DMD build

2012-12-28 Thread Nicolas Sicard
On Friday, 28 December 2012 at 15:29:58 UTC, Jacob Carlborg wrote: On 2012-12-28 16:18, Russel Winder wrote: Is there a reason for using g++ to compile and link the C code of DMD? As far as I know it doesn't work with Clang. Did you have any other compiler in mind? Actually it works with

Parsing error

2012-12-26 Thread Nicolas Sicard
I'm not sure whether this has been reported: --- struct Foo { void bar(T)() {} void baz() {} } void main() { Foo foo; (foo).bar!int(); // Compiler parsing error ((foo)).bar!int(); // OK foo.bar!int(); // OK (foo).baz(); // OK }

Re: Is there interest in a std.http?

2012-11-20 Thread Nicolas Sicard
On Tuesday, 20 November 2012 at 03:49:57 UTC, Tyler Jameson Little wrote: Would a minor refactor of vibe.d be acceptable? This is pretty much what I'm looking for: https://github.com/rejectedsoftware/vibe.d/blob/master/source/vibe/http/common.d

Array!bool and size_t

2012-05-15 Thread Nicolas Sicard
The implementation of std.container.Array!bool makes use of ulong instead of size_t as far as sizes and indices are concerned. This makes Array!bool inconsistent with other array-like types (including Array!T if !is(T==bool)) in 32-bit code. What would be the disadvantages of using size_t?

Re: Array!bool and size_t

2012-05-15 Thread Nicolas Sicard
On Tuesday, 15 May 2012 at 10:04:52 UTC, Dmitry Olshansky wrote: On 15.05.2012 13:44, Nicolas Sicard wrote: The implementation of std.container.Array!bool makes use of ulong instead of size_t as far as sizes and indices are concerned. This makes Array!bool inconsistent with other array-like

Re: Voldemort Types in D

2012-05-09 Thread Nicolas Sicard
On Wednesday, 9 May 2012 at 14:30:33 UTC, Andrei Alexandrescu wrote: http://www.reddit.com/r/programming/comments/telhj/voldemort_types_in_d/ Andrei One drawback of Voldemort types, is that they are incompatible with the generation of .di files (option -H). See

Re: [Issue 8063] Purity of assert's second parameter

2012-05-08 Thread Nicolas Sicard
--- Comment #1 from bearophile_h...@eml.cc 2012-05-08 04:12:12 PDT --- (In reply to comment #0) Calling impure functions in the second parameter of an assert statement within the body of a pure pure is an error, even in release mode. This is good. Since it is allowed to call impure

Re: D static lib called from C on Mac OS X

2012-04-27 Thread Nicolas Sicard
Bug report: http://d.puremagic.com/issues/show_bug.cgi?id=7995

Re: Power of D

2012-04-26 Thread Nicolas Sicard
On Thursday, 26 April 2012 at 10:50:49 UTC, David wrote: Am 26.04.2012 07:55, schrieb Era Scarecrow: Associative arrays? C++: #include map #include string mapstring, string m; Java: import java.util.*; MapString, String map = new HashMapString, String(); D: string[string] map (Don't know

D static lib called from C on Mac OS X

2012-04-25 Thread Nicolas Sicard
Hi, I am trying to use a D static library from C on Mac OSX Lion, but it always fails. --- file mylib.d --- module mylib; import core.runtime; extern(C) { bool mylib_init() { return Runtime.initialize(); } bool mylib_free() {

Re: D static lib called from C on Mac OS X

2012-04-25 Thread Nicolas Sicard
s/void/int in main.c

Re: D static lib called from C on Mac OS X

2012-04-25 Thread Nicolas Sicard
More testing. This: --- file mylib.d module mylib; import core.runtime; import std.stdio; extern(C) { bool mylib_init() { return Runtime.initialize(); } bool mylib_free() { return Runtime.terminate(); } void

Re: D static lib called from C on Mac OS X

2012-04-25 Thread Nicolas Sicard
On Wednesday, 25 April 2012 at 17:59:38 UTC, Andrej Mitrovic wrote: On 4/25/12, Nicolas Sicard dran...@gmail.com wrote: --- file main.c --- extern void mylib_init(); extern void mylib_free(); Try changing void to bool there. This was a typo in my first post. The problem is elsewhere

Re: [Kinda OT] httpd permissions

2012-04-25 Thread Nicolas Sicard
On Wednesday, 25 April 2012 at 18:11:16 UTC, Nathan M. Swan wrote: How do I deal with this (on OSX); are CGI programs not allowed to write to files? How to change this? Thanks, NMS test.d: #!/usr/local/bin/rdmd import std.stdio; void main() { writeln(Content-type:

final forbidden with value template parameters?

2009-01-03 Thread Nicolas Sicard
Hi module main; class Foo(string s) {} final class Bar(string s) {} // Error The compiler says: variable main.s final cannot be applied to variable Why is this forbidden? Nicolas (DMD 2.022 - Linux)