Re: assignment: left-to-right or right-to-left evaluation?

2009-06-21 Thread Sergey Gromov
Sat, 09 May 2009 11:43:09 -0500, Andrei Alexandrescu wrote: > If we want to get rid of newID, we'd write: > >writeln(dic.length, '\t', word); >dic[word] = dic.length; > > by the Python rule, and > >writeln(dic.length, '\t', word); >dic[word] = dic.length - 1; >

Re: D compiler as a C++ preprocessor

2009-06-28 Thread Sergey Gromov
Sat, 30 May 2009 04:16:09 -0400, Dmitry Sychov wrote: > Can D compiler be used only as a C++ preprocessor, that it to > generate C++ output (platform independent) to be later compiled via > the target platform C++ compiler? I'm sure translation from D into C were discussed before, not even once

Re: Reddit: why aren't people using D?

2009-07-26 Thread Sergey Gromov
Fri, 24 Jul 2009 16:58:50 -0500, Andrei Alexandrescu wrote: deterministic destructors, arbitrary copy constructors, and optional lack of default constructor. >>> Struct have that except for default constructor. In D, currently default >>> constructors cannot execute code. This is a limi

Re: Reddit: why aren't people using D?

2009-07-27 Thread Sergey Gromov
Sun, 26 Jul 2009 21:23:35 -0500, Andrei Alexandrescu wrote: > Sergey Gromov wrote: >> Fri, 24 Jul 2009 16:58:50 -0500, Andrei Alexandrescu wrote: >> >>>>>> deterministic destructors, arbitrary copy constructors, and optional >>>>>> lack of def

Re: Reddit: why aren't people using D?

2009-07-27 Thread Sergey Gromov
Wed, 22 Jul 2009 23:10:53 +0200, Michiel Helvensteijn wrote: > * Tuples (no dedicated syntax, no parallel assignment, no non-flattening > tuples without workarounds, no returning tuples) I'm planning to write a DIP on better tuple support. Here is a brief overview of my ideas. I think I'll blog

Re: Developing a plan for D2.0: Getting everything on the table

2009-07-28 Thread Sergey Gromov
Mon, 27 Jul 2009 07:59:40 -0500, Andrei Alexandrescu wrote: >> Is it appropriate to define multiple classes, structs, templates, etc >> within a single module? What considerations should inform the decision >> regarding the placement of module boundaries? > > I think it's appropriate because ma

Re: properties

2009-07-28 Thread Sergey Gromov
Tue, 28 Jul 2009 11:30:00 -0500, Andrei Alexandrescu wrote: The presence or absence of parens is a hard-coded accepted meaning of field vs. function. >>> >>> I understand how some people want to derive meaning from obj.foo() >>> versus obj.foo. I think they shouldn't in D. I mean D has

Re: properties

2009-07-28 Thread Sergey Gromov
Tue, 28 Jul 2009 13:20:30 -0400, Steven Schveighoffer wrote: > Let me come at another angle. You can't view properties as some sort of > enforcement by the compiler. The compiler is not guaranteeing that if you > call something without parentheses, it doesn't execute arbitrary code, it > h

Re: Properties poll

2009-07-28 Thread Sergey Gromov
Tue, 28 Jul 2009 18:57:03 -0300, Ary Borenszweig wrote: > Andrei Alexandrescu escribió: >> Ary Borenszweig wrote: >>> Actually it's not about properties, is about what "a.filter" and >>> "a.filter()" mean to you when you look at them. I used "filter" and >>> not "foo" because "foo" doesn't mean

Re: Dynamic D Library

2009-07-28 Thread Sergey Gromov
Tue, 28 Jul 2009 21:01:33 + (UTC), BCS wrote: > Reply to teo, > >> On Mon, 27 Jul 2009 20:34:44 +, BCS wrote: >> >>> Reply to teo, >>> I did some tests and here are the results: D cannot be used in Shared Objects. The only case that works is when no classes are exported a

Re: Developing a plan for D2.0: Getting everything on the table

2009-07-28 Thread Sergey Gromov
Wed, 29 Jul 2009 00:42:31 +0100, Stewart Gordon wrote: > Sergey Gromov wrote: >> Mon, 27 Jul 2009 07:59:40 -0500, Andrei Alexandrescu wrote: >> >>>> Is it appropriate to define multiple classes, structs, templates, etc >>>> within a single module? What co

Re: Properties: a.b.c = 3

2009-07-29 Thread Sergey Gromov
Wed, 29 Jul 2009 13:39:50 +1000, Daniel Keep wrote: > Walter Bright wrote: >> The issue is what if b is a property, returns a temporary object, and >> that temp's .c field is uselessly set to 3? >> >> It's a classic problem with properties that are implemented as functions. >> >> I don't see how

Re: overloading functions against function templates

2009-07-31 Thread Sergey Gromov
Thu, 30 Jul 2009 14:09:21 -0700, Walter Bright wrote: > Currently, that can't be done. But it would be good to get it in for D2. > The question is, what rule to use? > > I suggest that: > > 1. if any functions match, then overload functions the usual way > > 2. if no functions match, then over

Re: A simple rule

2009-07-31 Thread Sergey Gromov
Thu, 30 Jul 2009 21:57:33 +0200, downs wrote: > 1) If it's a word, put it in the standard library. > 2) Otherwise, put it in the compiler. > > For example: > > assert() -> library. > complex -> library. > void -> C-derived, compiler. > real -> C-derived via long float, compiler. > cfloat -> libr

Re: Some things to fix

2009-07-31 Thread Sergey Gromov
Fri, 31 Jul 2009 04:57:23 -0400, Sjoerd van Leent wrote: > Robert Fraser Wrote: > >> Ary Borenszweig wrote: >>> 2. modifiers that don't make sense should be disallowed. >> >> There's been wars about this one. IMO, this is a good thing for writing >> templated/generic code -- if a modifier only

Re: new DIP5: Properties 2

2009-07-31 Thread Sergey Gromov
Fri, 31 Jul 2009 00:02:16 -0400, Benji Smith wrote: > Nick Sabalausky wrote: >> "Andrei Alexandrescu" wrote in message >> news:h4lsuo$au...@digitalmars.com... >>> For me, I get a breath of fresh air whenever I get to not write "()". I >>> can't figure how some are missing it. >>> >> >> Every t

Re: new DIP5: Properties 2

2009-08-01 Thread Sergey Gromov
Fri, 31 Jul 2009 21:37:06 -0500, Andrei Alexandrescu wrote: > To clarify: if there was any extra checking by the compiler, any > guarantee that the feature would provide at all, I'd be glad to pay the > price of thinking more when putting together a design. But you want to > define a language f

Re: OS X Installer

2009-08-01 Thread Sergey Gromov
Sat, 1 Aug 2009 07:55:08 -0400, Michel Fortin wrote: > On 2009-08-01 04:41:38 -0400, Anders F Björklund said: > >> Jacob Carlborg wrote: >> Speaking of that OS X DMD installer, are you sure installing it at /usr/share/dmd/ is a good idea? [...] >>> I looked at a gdc installer and look

Re: property syntax strawman

2009-08-02 Thread Sergey Gromov
Sun, 02 Aug 2009 00:43:43 -0700, Walter Bright wrote: > Having optional parentheses does lead to unresolvable ambiguities. How > much of a problem that really is is debatable, but let's assume it > should be resolved. To resolve it, a property must be distinguishable > from a regular function.

Re: new DIP5: Properties 2

2009-08-02 Thread Sergey Gromov
Sat, 01 Aug 2009 23:36:57 -0400, Robert Jacques wrote: > On Sat, 01 Aug 2009 20:48:58 -0400, Andrei Alexandrescu > wrote: >> Sergey Gromov wrote: >>> Fri, 31 Jul 2009 21:37:06 -0500, Andrei Alexandrescu wrote: >>> >>>> To clarify: if there w

Re: new DIP5: Properties 2

2009-08-02 Thread Sergey Gromov
Sun, 02 Aug 2009 01:13:45 -0700, Walter Bright wrote: > Very sensible points. I'm really glad I can help.

Re: property syntax strawman

2009-08-03 Thread Sergey Gromov
Mon, 03 Aug 2009 11:06:53 -0400, Steven Schveighoffer wrote: > I just thought of another issue with property definitions. How do you > declare a property of an array? Today it's: > > char[] chomped(char[] input); > > Note that any getter property contains an argument which is the object >

Re: DIP6: Attributes

2009-08-03 Thread Sergey Gromov
Mon, 03 Aug 2009 15:16:25 -0400, Yigal Chripun wrote: > grauzone Wrote: > >> yigal chripun wrote: >>> this is a good start but as already noted by others, you can't specify >>> types with structs. we also can't use type tuples cause of the auto flatten >>> behavior. >> >> And why can't we use

Re: Just a thought: read-only fields

2009-08-04 Thread Sergey Gromov
Mon, 3 Aug 2009 22:04:51 -0400, Nick Sabalausky wrote: > It's been established in the recent epic-discussions on properties that one > of the biggest uses for properties is to implement publically read-only (but > privately-writable) fields. That got me thinking, why not actually have real > pu

Re: Iterators Must Go video online

2009-08-04 Thread Sergey Gromov
Mon, 03 Aug 2009 12:47:40 -0500, Andrei Alexandrescu wrote: > A while ago I mentioned the video of my BoostCon keynote "Iterators Must > Go" will be soon available online. Here it is: > > http://boostcon.blip.tv/ > > Andrei Nice talk! The "Try THAT with iterators, @"($#* !" part was especiall

Re: property syntax strawman

2009-08-04 Thread Sergey Gromov
Tue, 4 Aug 2009 01:15:45 +0400, Sergey Gromov wrote: > Mon, 03 Aug 2009 11:06:53 -0400, Steven Schveighoffer wrote: > >> I just thought of another issue with property definitions. How do you >> declare a property of an array? Today it's: >> >> char[] chom

Re: DIP6: Attributes

2009-08-04 Thread Sergey Gromov
Tue, 04 Aug 2009 17:22:50 +1000, Daniel Keep wrote: > Don wrote: >> ... >> >> A question: in C#/Java, can you have annotations on function pointer and >> delegate declarations? >> >> void foo( int delegate(int) pure dg) { >> ... >> } >> What would this look like with annotations? > > Well, Ja

Re: DIP6: Attributes

2009-08-04 Thread Sergey Gromov
Tue, 04 Aug 2009 22:46:22 +1000, Daniel Keep wrote: > Sergey Gromov wrote: >> Tue, 04 Aug 2009 17:22:50 +1000, Daniel Keep wrote: >> >>> Don wrote: >>>> ... >>>> >>>> A question: in C#/Java, can you have annotations on function poi

Re: DIP6: Attributes

2009-08-04 Thread Sergey Gromov
Tue, 04 Aug 2009 11:58:27 -0300, Ary Borenszweig wrote: > Sergey Gromov wrote: >> Tue, 04 Aug 2009 22:46:22 +1000, Daniel Keep wrote: >> >>> Sergey Gromov wrote: >>>> Tue, 04 Aug 2009 17:22:50 +1000, Daniel Keep wrote: >>>> >>>>>

Re: Naming things in Phobos - std.algorithm and writefln

2009-08-05 Thread Sergey Gromov
Wed, 05 Aug 2009 17:29:11 +1000, Daniel Keep wrote: > Michel Fortin wrote: >> In std.algorithm, wouldn't it be clearer if "splitter" was called >> "splitLazily" or "splitLazy"? "splitter" is a noun, but as a function >> shouldn't it be a verb. "makeSplitter" or "toSplitter" perhaps? > > This is a

Re: Properties and Copy Constructors

2009-08-06 Thread Sergey Gromov
Thu, 06 Aug 2009 18:08:00 -0400, Chad J wrote: > [snip] > > The jist is that you have some value type like a Matrix or BigInt that > might actually have memory allocated to it. It is a value type though, > so whenever it is copied, any memory allocated to it needs to also be > copied and new mem

Re: proposed syntax change

2009-08-07 Thread Sergey Gromov
Fri, 07 Aug 2009 13:47:31 -0700, Robert Jacques wrote: > On Fri, 07 Aug 2009 12:03:43 -0700, Yigal Chripun > wrote: > >> regarding the div() function above, I was thinking about using D's naked >> asm feature. From what little I know about this, the compiler doesn't >> generate the usual a

Re: T[new]

2009-08-09 Thread Sergey Gromov
Mon, 10 Aug 2009 01:56:35 +0200, Michiel Helvensteijn wrote: > Walter Bright wrote: > >>> But I know, unique isn't easy to implement to fit all the use cases we'd >>> like to solve. I'm just sharing a dream. >> >> We explored unique at length, and trying to make it work would render >> the rest

Re: T[new]

2009-08-10 Thread Sergey Gromov
Sun, 09 Aug 2009 13:29:21 -0700, Walter Bright wrote: > D has a number of subtle problems (performance and semantic) that arise > when arrays are resized. The solution is to separate resizeable array > types from slices. Slices will retain the old: > > T[] slice; > > syntax. Resizeable arr

Re: unittext extension proposal

2009-08-10 Thread Sergey Gromov
Sat, 08 Aug 2009 17:32:30 -0400, Jeremie Pelletier wrote: > I just had an idea to help keep track of unittests, right now we're turning > on printf's at the beginning of a test to know which one fails, and adding > printfs everywhere quickly becomes redundant. Also if the test succeeds and > ex

Re: proposed syntax change

2009-08-10 Thread Sergey Gromov
Fri, 07 Aug 2009 17:02:33 -0700, Robert Jacques wrote: >> Moreover compiler intrinsics are >> functions which compiler recognizes and treats specially, usually by >> replacing them with a single processor instruction. > > We weren't discussing implementation with intrinsics, but as with a > sta

Re: reddit.com: first Chapter of TDPL available for free

2009-08-10 Thread Sergey Gromov
Sun, 09 Aug 2009 16:10:38 -0500, Andrei Alexandrescu wrote: > Michel Fortin wrote: >> On 2009-08-09 14:10:10 -0400, Andrei Alexandrescu >> said: >> But shouldn't they work with *ranges* in general, a string being only a specific case? >>> >>> That's true as well! In my dreams, me and

Re: Properties, opIndex, and expression rewriting.

2009-08-11 Thread Sergey Gromov
Tue, 11 Aug 2009 03:19:42 -0400, Chad J wrote: > So, Walter, how about some expression rewriting logic to solve some of > the problems with properties, opIndex, and related lvalueness stuff? > > (I refer to the expression rewriting in the Wiki4D article on > properties: > http://prowiki.org/wiki4

Re: Notepad++

2009-08-12 Thread Sergey Gromov
Wed, 12 Aug 2009 18:12:41 +0100, Stewart Gordon wrote: > What's the best anybody's managed to get Notepad++ to syntax-highlight > D? (I'm on version 5.4.5, if that makes a difference.) > > My userDefineLang.xml file is as given here > http://www.prowiki.org/wiki4d/wiki.cgi?EditorSupport/Notepad

Re: Properties, opIndex, and expression rewriting.

2009-08-12 Thread Sergey Gromov
Tue, 11 Aug 2009 22:15:15 -0400, Chad J wrote: >> I've noticed an optimization which reduces number of calls to a getter. >> I think you shouldn't do that: you should call getter as many times as >> the expression suggests, and leave the rest to the optimizer. > > It's not so much an optimization

Re: Notepad++

2009-08-12 Thread Sergey Gromov
Thu, 13 Aug 2009 01:40:47 +0100, Stewart Gordon wrote: > Sergey Gromov wrote: >> Wed, 12 Aug 2009 18:12:41 +0100, Stewart Gordon wrote: > >> Scintilla uses plugins to highlight source. These plugins are written >> in C++ and have almost full access to the buffer so the

Re: Notepad++

2009-08-12 Thread Sergey Gromov
Wed, 12 Aug 2009 21:35:02 -0500, Andrei Alexandrescu wrote: > Sergey Gromov wrote: >> 2. Lexers are written in C++ and interface with the rest of Scintilla >> via C++ classes. Therefore if a field is added or removed anywhere, or >> if you use a different compiler to bui

Re: Notepad++

2009-08-14 Thread Sergey Gromov
Thu, 13 Aug 2009 22:57:24 +0100, Stewart Gordon wrote: > Sergey Gromov wrote: >> Well I think it's hard to create a regular expression engine flexible >> enough to allow arbitrary highlighting. > > I can't see how it can be at all complicated to find the beginn

Re: Notepad++

2009-08-15 Thread Sergey Gromov
Sat, 15 Aug 2009 01:36:26 +0100, Stewart Gordon wrote: > Sergey Gromov wrote: >> >> "foo >> bar" > > So there is a problem if the highlighter works by matching regexps on a > line-by-line basis. But matching regexps over a whole file is no harder >

Re: Notepad++

2009-08-17 Thread Sergey Gromov
Mon, 17 Aug 2009 21:23:56 +0100, Stewart Gordon wrote: > Sergey Gromov wrote: >> Highlighting the whole file every time a charater is typed is slow. >> Scintilla doesn't do that. It provides the lexer with a range of >> changed lines. The lexer is then free to c

Re: Notepad++

2009-08-17 Thread Sergey Gromov
Mon, 17 Aug 2009 10:37:47 +0200, Don wrote: > Sergey Gromov wrote: >> Then you have q"{foo}" where "{" and "}" can be any of ()[]<>{}. >> Regexps cannot translate while substituting, so you must create regexps >> for all possible parens. &

Re: Notepad++

2009-08-20 Thread Sergey Gromov
Tue, 18 Aug 2009 20:40:37 +0100, Stewart Gordon wrote: > Sergey Gromov wrote: >> Exactly. There is a 32-bit "style" known for every character, plus >> another 32-bit field associated with every line. A lexer is free to use >> these fields for any purpose, e

Re: Making Metaprogramming Pleasant and Fun

2009-08-30 Thread Sergey Gromov
Mon, 24 Aug 2009 00:25:19 -0400, Chad J wrote: > Suggestion 1: > > For any template whose argument list ends with a string argument, such > as this one: > > template foo( T, string arg ) > { > ... > } > > ... allow it to be instantiated (or mixed in) like so: > > foo!(T) > { > // Some toke

Sugar around string mixins (was: Why not move cast to the standard library?)

2009-10-03 Thread Sergey Gromov
Fri, 25 Sep 2009 15:35:11 -0400, Adam D. Ruppe wrote: > > macro max(int a, int b) { > return a ~ " > " ~ b ~ " ? " ~ a ~ " : " ~ b; > } > > void main() { > auto num1 = 10; > auto num2 = 20; > > auto result = max(num1, num2); > } > While I like and support the id

Re: Multiple subtyping with alias this and nested classes

2009-10-04 Thread Sergey Gromov
Sun, 04 Oct 2009 00:10:30 +0200, Yigal Chripun wrote: > > interface IBlipper > > { > > void blip(); > > void nameCollision(); > > } > > template Blipper() > > { > > void blip() {} > > void nameCollision() {} > > } > > > > interface IFlipper > > { > > void flip(); > > void

Re: Sugar around string mixins

2009-10-04 Thread Sergey Gromov
Sat, 3 Oct 2009 21:33:37 -0400, Jarrett Billingsley wrote: > On Sat, Oct 3, 2009 at 9:22 PM, Sergey Gromov wrote: > >> While I like and support the idea, I think that hijacking the "macro" >> keyword now will make it very hard to re-design later.  It would be much &

Re: T[new] misgivings

2009-10-17 Thread Sergey Gromov
Thu, 15 Oct 2009 21:55:07 -0500, Andrei Alexandrescu wrote: > int[new] a; > ... > a = [1, 2, 3]; > > What should that do? To me a is an array, a reference type. Therefore assignment here means rebinding a to a new array created from a literal. > A: Ok, then how do I say the common operation "I

Re: T[new] misgivings

2009-10-17 Thread Sergey Gromov
Thu, 15 Oct 2009 23:18:22 -0500, Andrei Alexandrescu wrote: > Jeremie Pelletier wrote: >> Andrei Alexandrescu wrote: >>> Jeremie Pelletier wrote: Andrei Alexandrescu wrote: > Walter Bright wrote: >> Andrei Alexandrescu wrote: >>> This goes into something more interesting that I th

Re: Revamping associative arrays

2009-10-18 Thread Sergey Gromov
Sun, 18 Oct 2009 06:18:34 -0400, bearophile wrote: >> Then I couldn't understand why the hell iterating on collection >> returns a key in the first place. It's so not intuitive.< > > What's intuitive on iterating on values? Well, I think Walter agrees > with you, I remember his explanation (itera

Re: Any chance to call Tango as Extended Standard Library

2009-01-19 Thread Sergey Gromov
Mon, 19 Jan 2009 06:15:06 -0800, Andrei Alexandrescu wrote: > Michel Fortin wrote: >> Other possible things involves a rudimentary profiler (checking for the >> elapsed time at each loop iteration), or a progress monitoring template >> (notifying another thread of the progress of a particular ta

Re: Any chance to call Tango as Extended Standard Library

2009-01-24 Thread Sergey Gromov
Thu, 22 Jan 2009 21:53:02 -0500, Michel Fortin wrote: > On 2009-01-19 18:11:15 -0500, Sergey Gromov said: > >> I think "can't" is a bit strong a statement. Let's see: >> >> With opApply: >> >> class progressUpdater(Collection) &g

Re: range and algorithm-related stuff

2009-01-25 Thread Sergey Gromov
Sat, 24 Jan 2009 17:09:07 -0800, Andrei Alexandrescu wrote: > I'm working on the new range stuff and the range-based algorithm. In all > likelihood, you all might be pleased with the results. > > I wanted to gauge opinions on a couple of issues. One is, should the > empty() member function for

Where to report bugs in DM tools?

2009-01-25 Thread Sergey Gromov
There's a bug in coffimplib: it silently overwrites a .lib file it converts if the lib's extension is not lower-case. While it should overwrite only when a -f flag is given. I wonder if these tools are even supported...

Re: ref returns and properties

2009-01-26 Thread Sergey Gromov
Mon, 26 Jan 2009 08:06:05 -0800, Andrei Alexandrescu wrote: > Anyhow, here's a simple D example. Consider we define a BigInt type as a > value-type struct: when you copy a BigInt to another, the latter becomes > an independent copy: > > BigInt a = 100; > BigInt b = a; > ++b; > assert(a == 100);

Re: range and algorithm-related stuff

2009-01-26 Thread Sergey Gromov
Sun, 25 Jan 2009 13:53:43 -0800, Andrei Alexandrescu wrote: > Christopher Wright wrote: >> Andrei Alexandrescu wrote: >>> Sergey Gromov wrote: >>>> Sat, 24 Jan 2009 17:09:07 -0800, Andrei Alexandrescu wrote: >>>> >>>>> I'm wo

Re: OT: Worthwhile *security-competent* web host?

2009-01-26 Thread Sergey Gromov
Sun, 25 Jan 2009 13:51:28 -0800, Andrei Alexandrescu wrote: > Christopher Wright wrote: >> Andrei Alexandrescu wrote: >>> Never ever *ever* EVER *EVER* email a password in clear. I'd say, if >>> anyone thinks she wants to do that, she doesn't deserve a server that >>> understands basic security

Scripting in D on Windows

2009-01-29 Thread Sergey Gromov
It is possible to make .d files automatically executable on Windows. For that you need: 1) modify the PATHEXT environment variable. It's a semicolon-separated list of executable extensions, so you just add ";.D" at the end 2) create a file association for .D and make the default action for it of

Re: Let's do front, back, popFront, and popBack!

2009-01-30 Thread Sergey Gromov
Thu, 29 Jan 2009 18:54:14 -0800, Andrei Alexandrescu wrote: > Let's!! I like it. I think this even was proposed before but was rejected because of Walter's attitude towards composite primitive names. I also like the symmetry because ranges are a more generic construct than single-linked lists wh

Re: Heap: container or range?

2009-01-30 Thread Sergey Gromov
Thu, 29 Jan 2009 21:26:39 -0800, Andrei Alexandrescu wrote: > Sean Kelly wrote: >> Sean Kelly wrote: >>> Andrei Alexandrescu wrote: Ah, never mind all that. I realized that I can't have a heap range. This is because heaps must mutate the underlying range in-place and any copy

Re: default random object?

2009-02-14 Thread Sergey Gromov
Fri, 13 Feb 2009 17:10:29 -0800, Andrei Alexandrescu wrote: > 4. While we're at it, should uniform(a, b) generate by default something > in [a, b] or [a, b)? Someone once explained to me that generating [a, b] > for floating point numbers is the source of all evils and that Hitler, > Stalin and

Re: Version declaration proposal

2009-02-14 Thread Sergey Gromov
Wed, 11 Feb 2009 07:24:31 -0500, Michel Fortin wrote: > My conclusion is that the only way to do such fine-grained versionning > in D is to use static ifs. If there were more than one version number > allowed (so I don't eat up the only one available which someone else > might want), this would

Re: boxing, struct opAssign and constructors

2009-02-15 Thread Sergey Gromov
Sat, 14 Feb 2009 15:25:23 +0200, gena wrote: > struct Value { >Value opAssign(double arg){...} > } > > Value v1, v2; > v1 = v2; > > With D2 (at least 014 and 023) I get compilation error: > function Value.opAssign (double arg) does not match parameter types (Value) The D2 specification seem

Re: Why version() ?

2009-02-15 Thread Sergey Gromov
Tue, 10 Feb 2009 13:34:35 +0100, grauzone wrote: > Frits van Bommel wrote: >> grauzone wrote: >>> Some severe disadvantages of version(): >>> 1. They can't contain expressions (like "version(linux && mac)"). >> >> Unless Apple has plans to s/BSD/Linux/ in MacOS that I'm not aware of, >> version(

Re: Why version() ?

2009-02-15 Thread Sergey Gromov
Tue, 10 Feb 2009 19:57:47 -0800, Walter Bright wrote: > Nick Sabalausky wrote: >> I have to admit, that's a very compelling example. I hadn't thought of >> anything like that. > > I didn't either, until I got bit by it . > >> I guess the moral is "DRY is normally great, but be very >> careful

Re: (non)nullable types

2009-02-16 Thread Sergey Gromov
Mon, 16 Feb 2009 13:26:29 +1100, Daniel Keep wrote: > To clarify: I am, and always have been, in full support of non-nullable > types, preferably by default. What I object to specifically in this > case is the requirement to always check that a nullable value is not > null every time it is used.

Re: problem with declaration grammar?

2009-02-19 Thread Sergey Gromov
Thu, 19 Feb 2009 01:30:36 -0500, jerry quinn wrote: > Christopher Wright Wrote: > >> jerry quinn wrote: >>> Hi there, >>> >>> I'm not sure if I'm missing something, but I'm having trouble seeing that a >>> simple declaration will parse correctly with the D grammar. >>> >>> If we take a declara

Re: memory-mapped files

2009-02-19 Thread Sergey Gromov
Wed, 18 Feb 2009 20:56:16 -0800, Andrei Alexandrescu wrote: > Benji Smith wrote: >> Andrei Alexandrescu wrote: >>> This all would make perfect sense if the performance was about the >>> same in the two cases. But in fact memory mapping introduced a large >>> *pessimization*. Why? I am supposedly

Re: Is str ~ regex the root of all evil, or the leaf of all good?

2009-02-20 Thread Sergey Gromov
Thu, 19 Feb 2009 07:46:47 -0800, Andrei Alexandrescu wrote: > The argument could go both ways: > > "Organize the set of 2-char strings starting with 'c' and ending with > 'a' to 'z' into a structured haystack, then look for substrings of > "conoco" in that haystack." > > versus > > "Given the

Re: problem with declaration grammar?

2009-02-20 Thread Sergey Gromov
Thu, 19 Feb 2009 20:55:52 -0500, jerry quinn wrote: > Sergey Gromov Wrote: > >> Thu, 19 Feb 2009 01:30:36 -0500, jerry quinn wrote: >> >>> Christopher Wright Wrote: >>> >>>> jerry quinn wrote: >>>>> Hi there, >>>>&g

Re: Is implicit string literal concatenation a good thing?

2009-02-22 Thread Sergey Gromov
Sun, 22 Feb 2009 10:21:20 +0100, Frank Benoit wrote: > Find the bug: > static string[] KEYWORDS = [ "abstract", "alias", "align", "asm", > "assert", "auto", "body", "bool", "break", "byte", "case", > "cast", "catch", "cdouble", "cent", "cfloat", "char", "class", > "cons

Re: Inline Functions

2009-02-26 Thread Sergey Gromov
Tue, 24 Feb 2009 14:08:26 -0500, Mason Green wrote: >> Have you profiled your D code? What has the profiling told you? Have you >> seen where you allocate memory, to move such allocations away from inner >> loops, or just reduce their number? > > > No, I have not profiled the D code other than

Re: Is implicit string literal concatenation a good thing?

2009-02-26 Thread Sergey Gromov
Mon, 23 Feb 2009 03:48:17 + (UTC), BCS wrote: > Hello bearophile, > >> If there are guarantees that "abc" "def" are folded at compile time, >> then the same guarantees can be specified for "abc" ~ "def". I can't >> see a problem. > > While it is not part of the spec, I do see a problem. If i

Re: Inline Functions

2009-02-26 Thread Sergey Gromov
Thu, 26 Feb 2009 14:43:11 -0800, Walter Bright wrote: > Sergey Gromov wrote: >> http://snakecoder.wordpress.com/2009/02/26/profiling-with-dmd-on-windows/ >> >> I already have some material for the second one, profiling Blaze. ;-) > > http://www.reddit.com/

Re: Inline Functions

2009-03-01 Thread Sergey Gromov
Thu, 26 Feb 2009 19:42:20 +0300, Sergey Gromov wrote: > Tue, 24 Feb 2009 14:08:26 -0500, Mason Green wrote: > >>> Have you profiled your D code? What has the profiling told you? Have you >>> seen where you allocate memory, to move such allocations away from inner &

Re: std.locale

2009-03-02 Thread Sergey Gromov
Mon, 02 Mar 2009 09:34:32 +0200, Georg Wrede wrote: >>> Of course, eventually we will want to "do something" about this. But >>> that should be left to the day when real issues are all sorted out in >>> D. This is a non-urgent, low-priority thing. > > Had there been any need for locales, believ

Re: Inline Functions

2009-03-02 Thread Sergey Gromov
Mon, 02 Mar 2009 07:12:41 -0500, Mason Green wrote: > Excellent, I've implemented your optimizations and left a more > detailed comment on the blog. I've also made a number of > optimizations to the physics engine over the weekend, and the > performance increase is phenomenal! > > http://svn.ds

Re: std.locale

2009-03-02 Thread Sergey Gromov
Mon, 02 Mar 2009 07:02:10 -0800, Andrei Alexandrescu wrote: > Consider some code in phobos that must throw an exception: > > throw Exception("File `%s' not found, system error is %s.", > filename, errnomsg); > > The localized version will look like this: > > auto format = "File `%s' not fo

Re: std.locale

2009-03-02 Thread Sergey Gromov
Mon, 02 Mar 2009 12:53:48 -0800, Andrei Alexandrescu wrote: > Rainer Deyke wrote: >> Sergey Gromov wrote: >>> To actually solve this problem the default exception handler must be >>> fixed to convert any UTF-8 into the current OEM code page before >>> prin

Re: std.locale

2009-03-03 Thread Sergey Gromov
Tue, 03 Mar 2009 07:05:51 -0800, Andrei Alexandrescu wrote: > bearophile wrote: >> Daniel Keep: >>> So I put contracts on everything. Fantastic. I do a release compile, >>> and all that safety disappears. So only the debug build has contracts >>> enabled. But it's the release build, if it cras

Re: The Sweet With

2009-03-05 Thread Sergey Gromov
Thu, 05 Mar 2009 07:38:23 -0500, Tomasz Sowiński wrote: > Walter Bright Wrote: > >> It looks nice, but has a subtle and disastrous problem. In D, arguments >> are fully resolved *before* overloading is done. If some of the >> overloads have with declarations, then there's a nightmarish problem

Re: in vs. const

2009-03-07 Thread Sergey Gromov
Sat, 7 Mar 2009 15:37:07 + (UTC), dsimcha wrote: > All the discussion about const on this NG lately has made me realize that I > have no idea what the difference is between const and in, i.e. what is the > difference between: > > SomeType foo(const SomeType bar) and > SomeType foo(in SomeType

Re: const?? When and why? This is ugly!

2009-03-07 Thread Sergey Gromov
Sat, 07 Mar 2009 15:19:50 -0800, Andrei Alexandrescu wrote: > To recap, if an API takes a string and all you have a char[], DO NOT > CAST IT. Call .idup - better safe than sorry. The API may evolve and > store a reference for later. Case in point: the up-and-coming > std.stdio.File constructor

Re: in vs. const

2009-03-08 Thread Sergey Gromov
Sat, 07 Mar 2009 17:43:19 -0800, Robert Fraser wrote: > Adam Burton wrote: >> Sean Kelly wrote: >> >>> dsimcha wrote: All the discussion about const on this NG lately has made me realize that I have no idea what the difference is between const and in, i.e. what is the difference be

Re: important proposal: scope keyword for class members

2009-03-08 Thread Sergey Gromov
Sun, 08 Mar 2009 16:06:56 -0700, Andrei Alexandrescu wrote: > Bill Baxter wrote: >> On Mon, Mar 9, 2009 at 7:12 AM, John Simon wrote: >>> Sean Kelly Wrote: >>> John Simon wrote: > Sean Kelly Wrote: >> Oh, I should mention that I'm not sure how the compiler would handle >> this sc

Re: const?? When and why? This is ugly!

2009-03-08 Thread Sergey Gromov
Sun, 08 Mar 2009 13:01:27 -0200, Ary Borenszweig wrote: > As I see it, the cast should fail saying "can't cast a to invariant > because a is mutable", because otherwise you are producing a behaviour > that doesn't match what the code says. > > In: > > char c; > int* p = cast(int*)&c; > *p = 5;

Re: const?? When and why? This is ugly!

2009-03-09 Thread Sergey Gromov
Sun, 08 Mar 2009 19:24:32 -0700, Andrei Alexandrescu wrote: > As far as signatures of functions in std.string, I agree that those not > needing a string of immutable characters should just accept in Char[] > (where Char is one of the three character types). That should make > people using mutab

Re: catchy phrase for this idiom?

2009-03-12 Thread Sergey Gromov
Thu, 12 Mar 2009 06:33:34 -0700, Andrei Alexandrescu wrote: > Hello, > > I'm looking for a catchy phrase denoting this D idiom: > > template Blah(Stuff) > { > alias ... Blah; > } > > i.e., defining inside a template a symbol of the same name as the > template itself. Then you can use Blah!

Re: catchy phrase for this idiom?

2009-03-14 Thread Sergey Gromov
Thu, 12 Mar 2009 18:21:04 -0700, Andrei Alexandrescu wrote: > Sergey Gromov wrote: >> Thu, 12 Mar 2009 06:33:34 -0700, Andrei Alexandrescu wrote: >> >>> Hello, >>> >>> I'm looking for a catchy phrase denoting this D idiom: >>&g

Re: memcpy vs slice copy

2009-03-15 Thread Sergey Gromov
Sun, 15 Mar 2009 13:17:50 + (UTC), Moritz Warning wrote: > On Sat, 14 Mar 2009 23:50:58 -0400, bearophile wrote: > >> While doing some string processing I've seen some unusual timings >> compared to the C code, so I have written this to see the situation >> better. When USE_MEMCPY is false th

Re: memcpy vs slice copy

2009-03-15 Thread Sergey Gromov
Sun, 15 Mar 2009 10:31:10 -0400, bearophile wrote: > The ASM of the inner loop: > > L: movl_h, %eax > movl%eax, (%edx) > movzwl _h+4, %eax > movw%ax, 4(%edx) > addl$6, %edx > cmpl%ecx, %edx > jne L Obviously, a memcpy intrinsic is at work here. DMD

Re: Proposal: fixing the 'pure' floating point problem.

2009-03-15 Thread Sergey Gromov
Sun, 15 Mar 2009 13:50:07 -0700, Walter Bright wrote: > Don wrote: >> Something interesting about my proposal is that although it is motivated >> by the purity problem, that's simply a rule for the compiler -- the >> rules for programmers do not involve purity at all.(See my other post). >> Do

Re: memcpy vs slice copy

2009-03-16 Thread Sergey Gromov
Mon, 16 Mar 2009 10:34:33 +0100, Don wrote: > Sergey Gromov wrote: >> Sun, 15 Mar 2009 13:17:50 + (UTC), Moritz Warning wrote: >> >>> On Sat, 14 Mar 2009 23:50:58 -0400, bearophile wrote: >>> >>>> While doing some string processing I've see

Re: Proposal: fixing the 'pure' floating point problem.

2009-03-17 Thread Sergey Gromov
Tue, 17 Mar 2009 03:38:23 -0700, Walter Bright wrote: > Don wrote: >> Walter Bright wrote: >>> Don wrote: A has called a function in B. B is not a floatingpoint module, so b() can only be called when the mode is set back to the default. a() violates this contract, so a() is incorr

Re: new D2.0 + C++ language

2009-03-18 Thread Sergey Gromov
Wed, 18 Mar 2009 13:48:55 -0400, Craig Black wrote: > bearophile Wrote: > >> Weed: >>> I want to offer the dialect of the language D2.0, suitable for use where >>> are now used C/C++. Main goal of this is making language like D, but >>> corresponding "zero-overhead principle" like C++: >>>... >>>

A bug in the back-end?

2009-03-18 Thread Sergey Gromov
I was reading the 1.041's back-end code. Here's something that looked wrong to me: in cgelem.c, in function elcmp(), at line 3318: case 4: if (sz > 2) e = el_una(OPu32_64,TYshort,e); else

  1   2   >