Re: Proposal: user defined attributes

2012-03-19 Thread dennis luehring
and how to add attribute parameters like DoSerialize(type=packed) for example - very very common in C# attributes and java annotations http://en.wikipedia.org/wiki/Java_annotation Am 19.03.2012 22:00, schrieb Andrei Alexandrescu: On 3/19/12 3:44 PM, Andrej Mitrovic wrote: On 3/19/12, Jacob C

Re: getHash inconsistency

2012-03-19 Thread Daniel Murphy
"H. S. Teoh" wrote in message news:mailman.910.1332214803.4860.digitalmar...@puremagic.com... > Is this a bug? > > char[] a = "abc".dup; > const(char)[] b = "abc"; > string c = "abc"; > > writeln(typeid(a).getHash(&a)); // 12914 > writeln(typeid(b).getHash(&b)); // 8503969683799911018 > writeln(t

Re: Proposal: user defined attributes

2012-03-19 Thread Kapps
On Monday, 19 March 2012 at 21:00:32 UTC, Andrei Alexandrescu wrote: On 3/19/12 3:55 PM, F i L wrote: I think this could get tricky for the compiler to confidently use given that the mixed in enums can collide with existing members (although not likely). Also, if objects are not identified as b

getHash inconsistency

2012-03-19 Thread H. S. Teoh
Is this a bug? char[] a = "abc".dup; const(char)[] b = "abc"; string c = "abc"; writeln(typeid(a).getHash(&a)); // 12914 writeln(typeid(b).getHash(&b)); // 8503969683799911018 writeln(typeid(c).getHash(&c)); // 12914 T -- Obviously, some things

Re: [scons-users] Evolving the D tool for SCons

2012-03-19 Thread H. S. Teoh
On Mon, Mar 19, 2012 at 08:43:44PM +0100, Andrej Mitrovic wrote: > On 3/19/12, H. S. Teoh wrote: > > dmd -unittest source.d > > > > in GDC, you'd have to write: > > > > gdc -funittest source.d > > > > That's what GDMD is for. It's a Perl script (in GDC's /bin folder) > that acts like a DM

Premake support for D

2012-03-19 Thread Andrew Gough
All, I just wanted to post a note here that I have added support for D(2) to premake (http://industriousone.com/premake). The fork is available on Bitbucket (https://bitbucket.org/goughy/premake-dev-d/overview) and I would really appreciate feedback if it's of interest to the community. I have

Re: Interesting Memory Optimization

2012-03-19 Thread James Miller
On 20 March 2012 13:17, H. S. Teoh wrote: >> Sites should be blazingly fast with today's computing power, but a >> ridiculous focus on "Developer productivity" has meant that no change >> has happened. > > Exactly! In spite of the fact that CPU speed has increased on the order > of a millionfold s

Re: Interesting Memory Optimization

2012-03-19 Thread H. S. Teoh
On Tue, Mar 20, 2012 at 12:55:29PM +1300, James Miller wrote: > On 20 March 2012 01:33, Derek wrote: > > Is the effort to do this really an issue with today's vast amounts > > of RAM (virtual and real) available? How much memory are you > > expecting to 'save'? > > > > And is RAM address alignment

Re: Interesting Memory Optimization

2012-03-19 Thread James Miller
On 20 March 2012 01:33, Derek wrote: > Is the effort to do this really an issue with today's vast amounts of RAM > (virtual and real) available? How much memory are you expecting to 'save'? > > And is RAM address alignment an issue here also? Currently most literals are > aligned on a 4 or 8-byte

Re: some regex vs std.ascii vs handcode times

2012-03-19 Thread Jay Norwood
On Monday, 19 March 2012 at 17:23:36 UTC, Andrei Alexandrescu wrote: On 3/18/12 11:12 PM, Jay Norwood wrote: I'm timing operations processing 10 2MB text files in parallel. I haven't gotten to the part where I put the words in the map, but I've done enough through this point to say a few things

Re: opEquals/opCmp returning other types

2012-03-19 Thread Simen Kjærås
On Mon, 19 Mar 2012 18:28:00 +0100, Simen Kjærås wrote: On Mon, 19 Mar 2012 09:29:34 +0100, Timon Gehr wrote: The current limitations make it impossible to define (for example) a floating point type with NaN that behaves like built-in float/double/real. As it turns out, this is possib

Re: Interesting Memory Optimization

2012-03-19 Thread H. S. Teoh
On Tue, Mar 20, 2012 at 12:05:55AM +0100, Timon Gehr wrote: > On 03/19/2012 01:33 PM, Derek wrote: > >On Fri, 16 Mar 2012 13:16:18 +1100, Kevin wrote: > > > >>This is in no way D specific but say you have two constant strings. > >> > >>const char[] a = "1234567890"; > >>// and > >>const char[] b =

Re: Interesting Memory Optimization

2012-03-19 Thread Timon Gehr
On 03/19/2012 01:33 PM, Derek wrote: On Fri, 16 Mar 2012 13:16:18 +1100, Kevin wrote: This is in no way D specific but say you have two constant strings. const char[] a = "1234567890"; // and const char[] b = "67890"; You could lay out the memory inside of one another. IE: if a.ptr = 1 then

Re: Why not finally allow bracket-less top-level keywords?

2012-03-19 Thread F i L
deadalnix wrote: As all functionnality of a Ship are final, you basically ends up with a mother ship that is a ship and then have some other function that are de facto separated and unreachable from ship. Yes, because Ship is designed to be the common denominator among Ship types. This is not

Re: Why not finally allow bracket-less top-level keywords?

2012-03-19 Thread Andrei Alexandrescu
On 3/19/12 5:11 PM, deadalnix wrote: Le 19/03/2012 21:39, F i L a écrit : deadalnix wrote: That is totally broken design. The fact that mothership inherit from ship is a pretty good example of misusing inheritance. The fireMissle is useless unless you KNOW that you are manipulating a MotherShip

Re: Why not finally allow bracket-less top-level keywords?

2012-03-19 Thread deadalnix
Le 19/03/2012 21:43, Walter Bright a écrit : On 3/18/2012 9:25 AM, FeepingCreature wrote: See subject. When proposing a new feature, the question is not "why not?". The question is what compelling capability does it bring. In this case, this isn't really a feature, but more syntaxic sugar.

Re: Why not finally allow bracket-less top-level keywords?

2012-03-19 Thread deadalnix
Le 19/03/2012 21:39, F i L a écrit : deadalnix wrote: That is totally broken design. The fact that mothership inherit from ship is a pretty good example of misusing inheritance. The fireMissle is useless unless you KNOW that you are manipulating a MotherShip, so you totally break all the abstrac

Re: Proposal: user defined attributes

2012-03-19 Thread Andrej Mitrovic
On 3/19/12, Jacob Carlborg wrote: > Yeah, but that will complicate the retrieval of the information. What is so complicated about extracting fields? Just iterate via .tupleof: module test; import std.stdio; import std.conv; struct Foo { int x; string name; mixin NonSerialized!name;

Re: Proposal: user defined attributes

2012-03-19 Thread Jacob Carlborg
On 2012-03-19 22:00, Andrei Alexandrescu wrote: I salute creative uses of the language over defining new features. Andrei Sure, just as well as you can do object oriented programming in C, but it is a mess. So is this. -- /Jacob Carlborg

Re: CTFE bug causes null check to pass on null pointers (Issue 7602)

2012-03-19 Thread Don
On 19.03.2012 22:14, H. S. Teoh wrote: On Mon, Mar 19, 2012 at 09:46:04PM +0100, Don wrote: On 19.03.2012 18:25, H. S. Teoh wrote: [...] The main idea is to require a minimal number of lowerings from the compiler (effectively nothing more than syntactic sugar such as V[K] and AA literal syntax

Re: Proposal: user defined attributes

2012-03-19 Thread Jacob Carlborg
On 2012-03-19 21:44, Andrej Mitrovic wrote: When I implemented NonSerialized for Vladimir's json library he made a suggestion to simply create enums of each field that is not to be serialized and encode it as "fieldname_nonSerialized". That would enable using a NonSerialized mixin multiple times

Mono-D@GSoC - Mentor needed

2012-03-19 Thread alex
Hi everyone, It may sounds a bit annoying because I already was asking everywhere in the IRC channels but still had no success - Is there anyone who wants to be my GSoC mentor for the Mono-D project? In the case you don't know what Mono-D is all about: It's about creating a D language bindi

Re: Understanding Templates: why can't anybody do it?

2012-03-19 Thread Nick Sabalausky
"Andrei Alexandrescu" wrote in message news:jk81a6$2o7l$1...@digitalmars.com... > On 3/19/12 1:59 PM, Sean Kelly wrote: >> I see this a lot, and it's why I wrote the chapter on templates for >> Learn to Tango with D. I don't think I can sort out releasing the >> chapter though. One approach is

Re: Proposal: user defined attributes

2012-03-19 Thread F i L
Andrej Mitrovic wrote: Also I've no idea what "objects being unique marked" means. I meant that Attribute metadata is distinct data in the compilers eyes, ie, no name magic, just attribute lookup.

Re: Proposal: user defined attributes

2012-03-19 Thread H. S. Teoh
On Mon, Mar 19, 2012 at 04:00:00PM -0500, Andrei Alexandrescu wrote: > On 3/19/12 3:44 PM, Andrej Mitrovic wrote: [...] > >So all you'd have to do is use compile-time introspection and a > >little bit of string processing to figure out if a field should be > >serialized or not. > > I salute creati

Re: CTFE bug causes null check to pass on null pointers (Issue 7602)

2012-03-19 Thread H. S. Teoh
On Mon, Mar 19, 2012 at 09:46:04PM +0100, Don wrote: > On 19.03.2012 18:25, H. S. Teoh wrote: [...] > >The main idea is to require a minimal number of lowerings from the > >compiler (effectively nothing more than syntactic sugar such as V[K] > >and AA literal syntax), and everything else will be do

Re: Proposal: user defined attributes

2012-03-19 Thread F i L
On Monday, 19 March 2012 at 21:00:32 UTC, Andrei Alexandrescu wrote: On 3/19/12 3:55 PM, F i L wrote: I think this could get tricky for the compiler to confidently use given that the mixed in enums can collide with existing members (although not likely). Also, if objects are not identified as b

Re: Proposal: user defined attributes

2012-03-19 Thread Andrei Alexandrescu
On 3/19/12 3:55 PM, F i L wrote: I think this could get tricky for the compiler to confidently use given that the mixed in enums can collide with existing members (although not likely). Also, if objects are not identified as being unique marked (in the compilers eyes), what specific attribute pos

Re: Proposal: user defined attributes

2012-03-19 Thread Andrei Alexandrescu
On 3/19/12 3:44 PM, Andrej Mitrovic wrote: On 3/19/12, Jacob Carlborg wrote: * Can be repeated on several fields (with the mixin you can only mixin "NonSerialized" once) When I implemented NonSerialized for Vladimir's json library he made a suggestion to simply create enums of each field that

Re: Proposal: user defined attributes

2012-03-19 Thread Andrej Mitrovic
On 3/19/12, F i L wrote: > Also, if objects are not identified as > being unique marked (in the compilers eyes), what specific > attribute post-fixes will it be searching for on enums members? I'm really not talking about general-purpose attributes, I was commenting on a specific serialization ex

Re: Proposal: user defined attributes

2012-03-19 Thread F i L
On Monday, 19 March 2012 at 20:44:43 UTC, Andrej Mitrovic wrote: On 3/19/12, Jacob Carlborg wrote: * Can be repeated on several fields (with the mixin you can only mixin "NonSerialized" once) When I implemented NonSerialized for Vladimir's json library he made a suggestion to simply create

Re: CTFE bug causes null check to pass on null pointers (Issue 7602)

2012-03-19 Thread Don
On 19.03.2012 18:25, H. S. Teoh wrote: On Mon, Mar 19, 2012 at 09:49:07AM +0100, Don Clugston wrote: [...] Yes. The existing D2 AA implementation is hopelessly broken. You have to understand that the whole implementation of AAs in D2 is a HACK. It is extremely complicated and the slightest chang

Re: Why not finally allow bracket-less top-level keywords?

2012-03-19 Thread Walter Bright
On 3/18/2012 9:25 AM, FeepingCreature wrote: See subject. When proposing a new feature, the question is not "why not?". The question is what compelling capability does it bring.

Re: Proposal: user defined attributes

2012-03-19 Thread Andrej Mitrovic
On 3/19/12, Jacob Carlborg wrote: > * Can be repeated on several fields (with the mixin you can only mixin > "NonSerialized" once) When I implemented NonSerialized for Vladimir's json library he made a suggestion to simply create enums of each field that is not to be serialized and encode it as "

Re: Why not finally allow bracket-less top-level keywords?

2012-03-19 Thread F i L
deadalnix wrote: That is totally broken design. The fact that mothership inherit from ship is a pretty good example of misusing inheritance. The fireMissle is useless unless you KNOW that you are manipulating a MotherShip, so you totally break all the abstraction the OOP could provide. Other

Re: Proposal: user defined attributes

2012-03-19 Thread Jacob Carlborg
On 2012-03-19 13:31, Steven Schveighoffer wrote: On Sun, 18 Mar 2012 04:03:29 -0400, Walter Bright I mean there is modifiable-at-runtime, instance-specific data. I don't think we should go this far with attributes. If you want to store instance-specific data, we already have a place for that.

Re: DMD Deadlocks

2012-03-19 Thread Sean Kelly
On Mar 19, 2012, at 12:21 PM, Benjamin Thaut wrote: > Am 19.03.2012 19:08, schrieb Sean Kelly: >> >> On Mar 19, 2012, at 10:58 AM, Benjamin Thaut wrote: >>> >>> I somehow hit a bug where dmd deadlocks within Mem::Free if I use -inline. >>> With previous bugs I was able to reduce my code using

Re: Understanding Templates: why can't anybody do it?

2012-03-19 Thread Philippe Sigaud
On Mon, Mar 19, 2012 at 20:37, H. S. Teoh wrote: > > It would be nice if somebody could write up a general introduction to > the idea of templates (not specific to D), the motivations behind it, > perhaps some historical background, and then eventually lead up to > advanced template tricks using D

Re: virtual-by-default rant

2012-03-19 Thread deadalnix
Le 18/03/2012 22:36, James Miller a écrit : On 19 March 2012 06:41, David Nadlinger wrote: On Sunday, 18 March 2012 at 17:24:15 UTC, F i L wrote: […] I know LDC has a LTO flag. Unfortunately it doesn't (-O4/-O5 are defunct), but working on seamless LTO integration (and better optimization

Re: [scons-users] Evolving the D tool for SCons

2012-03-19 Thread Andrej Mitrovic
On 3/19/12, H. S. Teoh wrote: > dmd -unittest source.d > > in GDC, you'd have to write: > > gdc -funittest source.d > That's what GDMD is for. It's a Perl script (in GDC's /bin folder) that acts like a DMD front-end to GDC, so you can pass regular DMD-style flags to GDC via GDMD. I th

Re: Understanding Templates: why can't anybody do it?

2012-03-19 Thread H. S. Teoh
On Mon, Mar 19, 2012 at 02:27:04PM -0500, Andrei Alexandrescu wrote: > On 3/19/12 1:59 PM, Sean Kelly wrote: > >I see this a lot, and it's why I wrote the chapter on templates for > >Learn to Tango with D. I don't think I can sort out releasing the > >chapter though. One approach is to think of t

Re: [scons-users] Evolving the D tool for SCons

2012-03-19 Thread H. S. Teoh
On Mon, Mar 19, 2012 at 05:47:11PM +, Russel Winder wrote: > On Mon, 2012-03-19 at 07:55 -0700, H. S. Teoh wrote: > [...] > > Thank you!!! The current D support in SCons is very spotty; I'm > > finding myself having to redefine DCOM and LINKCOM in order to make > > things work. I actually want

Re: Understanding Templates: why can't anybody do it?

2012-03-19 Thread Andrei Alexandrescu
On 3/19/12 1:59 PM, Sean Kelly wrote: I see this a lot, and it's why I wrote the chapter on templates for Learn to Tango with D. I don't think I can sort out releasing the chapter though. One approach is to think of templates as compile-time polymorphism. In Java, you might create a linked-lis

Re: DMD Deadlocks

2012-03-19 Thread Benjamin Thaut
Am 19.03.2012 19:08, schrieb Sean Kelly: On Mar 19, 2012, at 10:58 AM, Benjamin Thaut wrote: I somehow hit a bug where dmd deadlocks within Mem::Free if I use -inline. With previous bugs I was able to reduce my code using DustMite but with this one it is hard because dmd gives no output and

Re: DMD Deadlocks

2012-03-19 Thread Trass3r
I somehow hit a bug where dmd deadlocks within Mem::Free if I use -inline. With previous bugs I was able to reduce my code using DustMite but with this one it is hard because dmd gives no output and just freezes. Any ideas how I could reduce my code? You could play with DustMite + timeout.

Re: Keyword arguments / Named parameters library implementation

2012-03-19 Thread Andrej Mitrovic
On 3/19/12, Matthias Walter wrote: > Hi, > > I've written a small module (at the moment called utils.keywordargs) > which simulates keyword arguments (aka named parameters). Cool. A small tip (in case you didn't already know): You can use allSatisfy from std.typetuple when checking a single cons

Re: opEquals/opCmp returning other types

2012-03-19 Thread Brian Palmer
On Monday, 19 March 2012 at 15:33:33 UTC, Andrei Alexandrescu wrote: For D, hooking built-in operators is a poor way to implement DSLs. Best is to use strings, CTFE, and mixin. Andrei Hmm I have to say I'm not (yet) convinced. But I'll try to drink the kool-aid and see if it converts me. I'

Re: Understanding Templates: why can't anybody do it?

2012-03-19 Thread Sean Kelly
On Mar 17, 2012, at 10:14 AM, Entity325 wrote: > (Sorry if this is the wrong place for this, or if there's already a thread in > existence which would be better. If either of these is the case, simply > point me in the right direction, and I'll be on my way.) > > My first interaction with Temp

Re: Keyword arguments / Named parameters library implementation

2012-03-19 Thread bearophile
Matthias Walter: > I've written a small module (at the moment called utils.keywordargs) > which simulates keyword arguments (aka named parameters). The > documentation can be found here, Regardless the implementation quality of your code, I wait for the real thing :-) Bye, bearophile

Re: Why not finally allow bracket-less top-level keywords?

2012-03-19 Thread deadalnix
Le 19/03/2012 17:28, Gor Gyolchanyan a écrit : Because of the syntax sugar. This is exactly the type of behavior that a language should discourage.

Re: Why not finally allow bracket-less top-level keywords?

2012-03-19 Thread deadalnix
Le 19/03/2012 18:41, F i L a écrit : deadalnix wrote: It looks like a bad usage of inheritance. If you want to use these methods, why not use composition ? It make no sense to use such an inherited class in a polymorphic context, so why use inheritance at all ? Am I missing something about wh

Re: DMD Deadlocks

2012-03-19 Thread Sean Kelly
On Mar 19, 2012, at 10:58 AM, Benjamin Thaut wrote: > > I somehow hit a bug where dmd deadlocks within Mem::Free if I use -inline. > With previous bugs I was able to reduce my code using DustMite but with this > one it is hard because dmd gives no output and just freezes. Any ideas how I > cou

DMD Deadlocks

2012-03-19 Thread Benjamin Thaut
Hi, I somehow hit a bug where dmd deadlocks within Mem::Free if I use -inline. With previous bugs I was able to reduce my code using DustMite but with this one it is hard because dmd gives no output and just freezes. Any ideas how I could reduce my code? Callstack: kernel32.dll!_WaitForSingl

Re: Implicit integer casting

2012-03-19 Thread Andrej Mitrovic
On 3/19/12, Steven Schveighoffer wrote: > What if you don't have std.random's source, all you (the compiler) have is > the function signature? I know there are what ifs, but in this case it's a template.

Re: Why not finally allow bracket-less top-level keywords?

2012-03-19 Thread F i L
deadalnix wrote: It looks like a bad usage of inheritance. If you want to use these methods, why not use composition ? It make no sense to use such an inherited class in a polymorphic context, so why use inheritance at all ? Am I missing something about what you're saying? Having a final cla

Keyword arguments / Named parameters library implementation

2012-03-19 Thread Matthias Walter
Hi, I've written a small module (at the moment called utils.keywordargs) which simulates keyword arguments (aka named parameters). The documentation can be found here, http://xammy.xammy.homelinux.net/~xammy/utils_keywordargs.html while the code is at http://xammy.xammy.homelinux.net/~xammy/key

Re: opEquals/opCmp returning other types

2012-03-19 Thread Simen Kjærås
On Mon, 19 Mar 2012 09:29:34 +0100, Timon Gehr wrote: The current limitations make it impossible to define (for example) a floating point type with NaN that behaves like built-in float/double/real. As it turns out, this is possible. opCmp can return a float, and things work just fine (!<,

Re: some regex vs std.ascii vs handcode times

2012-03-19 Thread Andrei Alexandrescu
On 3/18/12 11:12 PM, Jay Norwood wrote: I'm timing operations processing 10 2MB text files in parallel. I haven't gotten to the part where I put the words in the map, but I've done enough through this point to say a few things about the measurements. Great work! This prompts quite a few bug rep

Re: CTFE bug causes null check to pass on null pointers (Issue 7602)

2012-03-19 Thread H. S. Teoh
On Mon, Mar 19, 2012 at 09:49:07AM +0100, Don Clugston wrote: [...] > Yes. The existing D2 AA implementation is hopelessly broken. > You have to understand that the whole implementation of AAs in D2 is > a HACK. It is extremely complicated and the slightest change to any > code in the compiler or t

Re: Why not finally allow bracket-less top-level keywords?

2012-03-19 Thread Gor Gyolchanyan
Because of the syntax sugar. On Mon, Mar 19, 2012 at 8:26 PM, deadalnix wrote: > Le 19/03/2012 14:38, Gor Gyolchanyan a écrit : > >> Having a final class is conceptually different from having a class >> with only final methods. You can legitimately inherit from a class >> with no virtual methods

Re: Why not finally allow bracket-less top-level keywords?

2012-03-19 Thread deadalnix
Le 19/03/2012 14:38, Gor Gyolchanyan a écrit : Having a final class is conceptually different from having a class with only final methods. You can legitimately inherit from a class with no virtual methods and add to its interface and implement other methods using its final ones. The final class c

Re: Proposal: user defined attributes

2012-03-19 Thread RivenTheMage
On Monday, 19 March 2012 at 00:41:44 UTC, Walter Bright wrote: Maybe this is why I don't much care for attributes - it's all just a fog to me what is happening. Maybe this will help: http://research.microsoft.com/en-us/um/people/cszypers/events/WCOP2006/rouvoy-wcop-06.pdf Attribute-Oriented

Re: opEquals/opCmp returning other types

2012-03-19 Thread Andrei Alexandrescu
On 3/19/12 10:17 AM, Brian Palmer wrote: On Monday, 19 March 2012 at 01:29:50 UTC, H. S. Teoh wrote: In C++, for example, you can define operator<() and operator>() in completely arbitrary ways, which means they can be totally unrelated to each other, and return results that have nothing to do

Re: opEquals/opCmp returning other types

2012-03-19 Thread Paulo Pinto
I think the only people who have issues with operator definitions don't think of them as function names, in the abstract mathematics sense. +, < and so on are just simbolic names for some operation. If I want to know what + does, I have to do the same as when I see Add, and look to the definitio

Re: opEquals/opCmp returning other types

2012-03-19 Thread Brian Palmer
On Monday, 19 March 2012 at 01:29:50 UTC, H. S. Teoh wrote: In C++, for example, you can define operator<() and operator>() in completely arbitrary ways, which means they can be totally unrelated to each other, and return results that have nothing to do with each other. This causes inconsisten

Re: Ddoc as general documentation tool

2012-03-19 Thread Gour
On Mon, 19 Mar 2012 09:55:40 -0500 Andrei Alexandrescu wrote: > DDoc has two main assets: (a) it understands D structures, e.g. you > can use it to document D APIs, and (b) it highlights D code nicely. Yeah, that's anticpated usage of it. > More specialized tools that have a focus on document f

Re: Ddoc as general documentation tool (was Re: DDoc and logically structured HTML)

2012-03-19 Thread Andrei Alexandrescu
On 3/19/12 5:01 AM, Gour wrote: On Sun, 11 Mar 2012 01:08:20 + Stewart Gordon wrote: Has anybody else got further with getting logical HTML out of DDoc? Have you been using DDoc to generate some internal format and then some other program to turn it into HTML, or what? Excuse me for jump

Re: [scons-users] Evolving the D tool for SCons

2012-03-19 Thread H. S. Teoh
On Mon, Mar 19, 2012 at 12:12:27PM +, Russel Winder wrote: > I will likely be able to do some work on the D tool for SCons over the > next few weeks. As preparation, I am wondering about the DMD, GDC, LDC > issue and also the fact that currently DMD is only used as a > front-end, GCC or whateve

Re: The definition of templates in D

2012-03-19 Thread Artur Skawina
On 03/18/12 12:34, Derek wrote: > On Sun, 18 Mar 2012 22:00:06 +1100, Derek wrote: > >> >> The 'adding' is not the point; it could be any functionality. The point I >> was trying to get across was that it would be useful if the compiler could >> infer the type parameters of a template instantia

Re: Understanding Templates: why can't anybody do it?

2012-03-19 Thread Gour
On Sun, 18 Mar 2012 11:04:45 +0100 Paulo Pinto wrote: > Enterprise software? Not here, we'll write open-source project. ;) Sincerely, Gour -- All living bodies subsist on food grains, which are produced from rains. Rains are produced by performance of yajña [sacrifice], and yajña is born

Re: Why not finally allow bracket-less top-level keywords?

2012-03-19 Thread Gor Gyolchanyan
Having a final class is conceptually different from having a class with only final methods. You can legitimately inherit from a class with no virtual methods and add to its interface and implement other methods using its final ones. The final class concept is extremely useful when you just don't wa

Re: virtual-by-default rant

2012-03-19 Thread Dmitry Olshansky
On 19.03.2012 14:45, Artur Skawina wrote: On 03/19/12 08:30, Dmitry Olshansky wrote: On 19.03.2012 2:17, Artur Skawina wrote: On 03/18/12 15:37, Dmitry Olshansky wrote: On 18.03.2012 5:23, Manu wrote: The virtual model broken. I've complained about it lots, and people always say "stfu, use 'f

Re: Proposal: user defined attributes

2012-03-19 Thread dennis luehring
exactly my point - thx Am 19.03.2012 13:31, schrieb Steven Schveighoffer: On Sun, 18 Mar 2012 04:03:29 -0400, Walter Bright wrote: On 3/17/2012 10:01 PM, F i L wrote: Walter Bright wrote: My impression is it is just obfuscation around a simple lazy initialization pattern. While I ca

Re: Interesting Memory Optimization

2012-03-19 Thread Derek
On Fri, 16 Mar 2012 13:16:18 +1100, Kevin wrote: This is in no way D specific but say you have two constant strings. const char[] a = "1234567890"; // and const char[] b = "67890"; You could lay out the memory inside of one another. IE: if a.ptr = 1 then b.ptr = 6. I'm not sure if this has

Re: Proposal: user defined attributes

2012-03-19 Thread Steven Schveighoffer
On Sun, 18 Mar 2012 04:03:29 -0400, Walter Bright wrote: On 3/17/2012 10:01 PM, F i L wrote: Walter Bright wrote: My impression is it is just obfuscation around a simple lazy initialization pattern. While I can see the abstraction usefulness of compile time attribute metadata, I am hav

Re: Implicit integer casting

2012-03-19 Thread Steven Schveighoffer
On Sun, 18 Mar 2012 22:46:56 -0400, James Miller wrote: Another thing I have noticed, is that that compared to a cast, to! is incredibly slow. Most of the time it doesn't matter, but I was doing some work with noise generation, and found that casting the floats to integers was an order of magn

Re: Implicit integer casting

2012-03-19 Thread Steven Schveighoffer
On Sun, 18 Mar 2012 15:53:56 -0400, Andrej Mitrovic wrote: On 3/18/12, Manu wrote: I'm finding that in this code I'm writing, casts are taking up more space on many lines than the actual term being assigned. Another classic which fails to compile is: import std.random; ubyte c = unifor

Re: Interesting Memory Optimization

2012-03-19 Thread Steven Schveighoffer
On Thu, 15 Mar 2012 22:16:18 -0400, Kevin wrote: This is in no way D specific but say you have two constant strings. const char[] a = "1234567890"; // and const char[] b = "67890"; You could lay out the memory inside of one another. IE: if a.ptr = 1 then b.ptr = 6. I'm not sure if this has

Re: CTFE bug causes null check to pass on null pointers (Issue 7602)

2012-03-19 Thread Daniel Murphy
"Don Clugston" wrote in message news:jk6ru4$1seu$1...@digitalmars.com... > > I do not understand why it still part of the compiler after we agreed to > roll back to the D1 version. > Walter didn't agree, so it didn't happen.

Re: virtual-by-default rant

2012-03-19 Thread Artur Skawina
On 03/19/12 08:30, Dmitry Olshansky wrote: > On 19.03.2012 2:17, Artur Skawina wrote: >> On 03/18/12 15:37, Dmitry Olshansky wrote: >>> On 18.03.2012 5:23, Manu wrote: The virtual model broken. I've complained about it lots, and people always say "stfu, use 'final:' at the top of your cla

Re: Proposal: user defined attributes

2012-03-19 Thread dennis luehring
Am 19.03.2012 10:03, schrieb F i L: dennis luehring wrote: i don't get the GC relation here? all attribute values are static const - because they are type-related (static) and read-only, attributes are type orientated not instance orientated C# doesn't support free-types (everything's wra

Re: page size in druntime is a mess

2012-03-19 Thread Alex Rønne Petersen
On 19-03-2012 11:12, Alex Rønne Petersen wrote: On 19-03-2012 11:03, deadalnix wrote: Le 18/03/2012 16:09, Sean Kelly a écrit : On Mar 18, 2012, at 7:12 AM, deadalnix wrote: Page size in druntime is sometime a constant (4Kb), sometime calculated, often assumed to be a compile time constant.

Re: Proposal: user defined attributes

2012-03-19 Thread Jacob Carlborg
On 2012-03-19 09:01, Tove wrote: Well I was thinking if we can go one step further than C#, because of D:s CTFE... by introducing a call back from the D compiler to the library CTFE attribute handler... this way we can hide all reflection from the "end user"... and the compiler doesn't need to kn

Re: page size in druntime is a mess

2012-03-19 Thread Alex Rønne Petersen
On 19-03-2012 11:03, deadalnix wrote: Le 18/03/2012 16:09, Sean Kelly a écrit : On Mar 18, 2012, at 7:12 AM, deadalnix wrote: Page size in druntime is sometime a constant (4Kb), sometime calculated, often assumed to be a compile time constant. druntime should define a proper, authoritative, p

Re: Why not finally allow bracket-less top-level keywords?

2012-03-19 Thread deadalnix
Le 18/03/2012 18:06, Simen Kjærås a écrit : On Sun, 18 Mar 2012 18:07:10 +0100, deadalnix wrote: Le 18/03/2012 17:49, Timon Gehr a écrit : On 03/18/2012 05:25 PM, FeepingCreature wrote: Advantages: internally consistent, no need for completely new syntax, "final class" can be deprecated (it

Ddoc as general documentation tool (was Re: DDoc and logically structured HTML)

2012-03-19 Thread Gour
On Sun, 11 Mar 2012 01:08:20 + Stewart Gordon wrote: > Has anybody else got further with getting logical HTML out of DDoc? > Have you been using DDoc to generate some internal format and then > some other program to turn it into HTML, or what? Excuse me for jumping into the thread, but I hop

Re: Why not finally allow bracket-less top-level keywords?

2012-03-19 Thread deadalnix
Le 18/03/2012 19:57, Andrej Mitrovic a écrit : On 3/18/12, deadalnix wrote: Le 18/03/2012 17:49, Timon Gehr a écrit : On 03/18/2012 05:25 PM, FeepingCreature wrote: Advantages: internally consistent, no need for completely new syntax, "final class" can be deprecated (it never worked well any

Re: page size in druntime is a mess

2012-03-19 Thread deadalnix
Le 18/03/2012 16:09, Sean Kelly a écrit : On Mar 18, 2012, at 7:12 AM, deadalnix wrote: Page size in druntime is sometime a constant (4Kb), sometime calculated, often assumed to be a compile time constant. druntime should define a proper, authoritative, place to calculate that page size, an

Re: Compiler fails to match array literal to byte[] in templated functions (Was: Re: More putrid beef soup (Was: Re: Implicit string lit conversion) to wstring/dstring)

2012-03-19 Thread Timon Gehr
On 03/19/2012 04:40 AM, H. S. Teoh wrote: OK, perhaps the previous subject line of the previous post deterred people from actually reading the contents. :-( Basically, I'm trying to address Andrei's request that this should work with my AA implementation: int[dstring] aa; aa["ab

Re: SCons support for D

2012-03-19 Thread Gour
On Mon, 19 Mar 2012 11:21:41 +0200 Manu wrote: > Can I see your changes anywhere? I have a premake based project > infrastructure that I'd like to incorporate some D code into. https://bitbucket.org/goughy/premake-dev-d Sincerely, Gour -- One is understood to be in full knowledge whose every

Re: SCons support for D

2012-03-19 Thread Manu
On 7 December 2011 11:27, Andrew Gough wrote: > It seems there is SCons support (python), CMake, Orbit (Ruby), DSSS > (D1 only?), xfbuild, dake, rdmd options - I've added preliminary D > support to premake. > Can I see your changes anywhere? I have a premake based project infrastructure that I'd

Re: Proposal: user defined attributes

2012-03-19 Thread Manu
On 19 March 2012 08:46, dennis luehring wrote: > > attributes does not containing code - there just a (at-runtime) queryable > information that can be attached to serveral things (like classes, methods, > ...) - think of it like double.epsilon - but extendable by users - thats > it, and in the c#

Re: Proposal: user defined attributes

2012-03-19 Thread F i L
dennis luehring wrote: i don't get the GC relation here? all attribute values are static const - because they are type-related (static) and read-only, attributes are type orientated not instance orientated C# doesn't support free-types (everything's wrapped up in classes) so the technique i

Re: CTFE bug causes null check to pass on null pointers (Issue 7602)

2012-03-19 Thread Don Clugston
On 19/03/12 06:43, H. S. Teoh wrote: While testing my AA implementation on existing AA-related bug, I came across this issue: http://d.puremagic.com/issues/show_bug.cgi?id=7602 Upon playing around a bit with the sample code given in the bug, I managed to find a code snippet that would c

Re: opEquals/opCmp returning other types

2012-03-19 Thread Jacob Carlborg
On 2012-03-19 01:54, Brian Palmer wrote: I'm working on a DSL for generating SQL queries, based loosely on Python's SQLAlchemy and Ruby's Sequel. One nice thing about the DSL is the compact syntax for specifying WHERE clauses. With some fiddling, I got it working for opEquals, a simplified exampl

Re: opEquals/opCmp returning other types

2012-03-19 Thread Timon Gehr
On 03/19/2012 02:31 AM, H. S. Teoh wrote: On Mon, Mar 19, 2012 at 01:54:27AM +0100, Brian Palmer wrote: [...] However, this won't work for comparison operators like< and>, which all map to opCmp, or for != (since that's rewritten to !(a == b)) I guess I have two questions, one, am I going to s

Re: Proposal: user defined attributes

2012-03-19 Thread Jacob Carlborg
On 2012-03-19 01:41, Walter Bright wrote: On 3/18/2012 2:58 PM, Jacob Carlborg wrote: Ok, now to the user defined attribute: @attribute class NonSerialized {} // This is what's called a "marker" in Java. It doesn't contain any information, the information is the type itself. @attribute class S

Re: Proposal: user defined attributes

2012-03-19 Thread dennis luehring
i don't get the GC relation here? all attribute values are static const - because they are type-related (static) and read-only, attributes are type orientated not instance orientated @GC.NoScan int value; @GC this() {} Compiler Asks library for transformation of unknown @GC bool library("@G

Re: Proposal: user defined attributes

2012-03-19 Thread Tove
On Monday, 19 March 2012 at 06:46:09 UTC, dennis luehring wrote: Am 19.03.2012 01:41, schrieb Walter Bright: I'm sorry, I find this *massively* confusing. What is foo? Why are you serializing something marked "NonSerialized"? I really have no idea what is going on with this. What is the seriali

Re: some regex vs std.ascii vs handcode times

2012-03-19 Thread Dmitry Olshansky
On 19.03.2012 8:12, Jay Norwood wrote: I'm timing operations processing 10 2MB text files in parallel. I haven't gotten to the part where I put the words in the map, but I've done enough through this point to say a few things about the measurements. I hope you are going to tell us dmd flags be

  1   2   >