Re: Nothrow, pure in druntime

2009-01-26 Thread Don
Walter Bright wrote: dsimcha wrote: I assume, when referring to the ones that do throw, you mean functions written in C++ or D, but declared w/ C linkage. If so, you could make this a per-module setting that defaults to not assuming nothrow. For example, let's say you made this pragma(Linkag

Re: Nothrow, pure in druntime

2009-01-26 Thread Walter Bright
Don wrote: tango.math doesn't use the C library at all, except when inline asm is unavailable. Of they differ from the C functions, in that none of them set errno! One really annoying issue still remains, though -- the floating point flags in the CPU. They are entirely deterministic, but are th

Re: Nothrow, pure in druntime

2009-01-26 Thread Don
Walter Bright wrote: Don wrote: tango.math doesn't use the C library at all, except when inline asm is unavailable. Of they differ from the C functions, in that none of them set errno! One really annoying issue still remains, though -- the floating point flags in the CPU. They are entirely det

Re: D to C compiler?

2009-01-26 Thread Kagamin
dsimcha Wrote: > Is there any decent reading material out there about how exception handling is > works under the hood Matt Pietrek is famous for such a material. You can also look at NtRaiseException in wine sources.

Checked oveflows in C#

2009-01-26 Thread bearophile
It seems one group of ideas and syntax I did suggest for D weren't so Krazy, after all. I have just found that they can be seen almost equal in C#. You can read something about them here: http://msdn.microsoft.com/en-us/library/a569z7k8.aspx There is the checked/unchecked keyword that can be use

Re: Could we get a LP64 version identifier?

2009-01-26 Thread Frits van Bommel
Jacob Carlborg wrote: Frits van Bommel wrote: Jacob Carlborg wrote: Could we get a LP64 version identifier? I know that you can use this code: "static if ((void*).sizeof > int.sizeof)" Shouldn't that be "static if ((void*).sizeof == long.sizeof)" or just "static if ((void*).sizeof == 8)"?

Re: Could we get a LP64 version identifier?

2009-01-26 Thread Frits van Bommel
Jacob Carlborg wrote: Walter Bright wrote: Jacob Carlborg wrote: Could we get a LP64 version identifier? I know that you can use this code: "static if ((void*).sizeof > int.sizeof)" to do the same but that's not particular clear that the programmer wants to check for LP64. If so, I hope we

Re: Nothrow, pure in druntime

2009-01-26 Thread Michel Fortin
On 2009-01-25 14:39:52 -0500, Walter Bright said: I did think of making all functions that are extern(C) automatically nothrow, but was concerned that it would result in a lot of bugs and broken code from ones that did throw. It's better that way, because it allows you to write proper wrappe

Re: ref returns and properties

2009-01-26 Thread Jacob Carlborg
Andrei Alexandrescu wrote: Michiel Helvensteijn wrote: Andrei Alexandrescu wrote: void move(ref T src, ref T dst); void swap(ref T lhs, ref T rhs); ... But if "prop" is a property with get and set, everything falls apart. Properties effectively hide the address of the actual data and only tr

Re: Could we get a LP64 version identifier?

2009-01-26 Thread Jacob Carlborg
Walter Bright wrote: Jacob Carlborg wrote: Could we get a LP64 version identifier? I know that you can use this code: "static if ((void*).sizeof > int.sizeof)" to do the same but that's not particular clear that the programmer wants to check for LP64. If so, I hope we could get it in D1 also

Re: ref returns and properties

2009-01-26 Thread Sean Kelly
Daniel Keep wrote: Andrei Alexandrescu wrote: Denis Koroskin wrote: [snip] get/set/free? With these you can't move a resource inside the property. Andrei Python has an overload for removing properties. In all my years of using Python, I've *NEVER* once had a use for it, or even worked out

Re: range and algorithm-related stuff

2009-01-26 Thread Steven Schveighoffer
"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 ranges be const? On the face of it

Re: ref returns and properties

2009-01-26 Thread Andrei Alexandrescu
Jacob Carlborg wrote: [on properties] What about this: class Host { property acquire release prop { T get(); } } And then the compiler will automatically created the "acquire" and "release" methods. There could also be what I would like to call "property shortcuts" (r

Re: ref returns and properties

2009-01-26 Thread Daniel Keep
Sean Kelly wrote: > Daniel Keep wrote: >> Andrei Alexandrescu wrote: >>> Denis Koroskin wrote: [snip] get/set/free? >>> With these you can't move a resource inside the property. >>> >>> Andrei >> >> Python has an overload for removing properties. In all my years of >> using Python

Re: range and algorithm-related stuff

2009-01-26 Thread Andrei Alexandrescu
Steven Schveighoffer wrote: "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 ranges be co

Re: ref returns and properties

2009-01-26 Thread Don
Andrei Alexandrescu wrote: Jacob Carlborg wrote: [on properties] What about this: class Host { property acquire release prop { T get(); } } And then the compiler will automatically created the "acquire" and "release" methods. There could also be what I would like to

Re: ref returns and properties

2009-01-26 Thread Andrei Alexandrescu
Daniel Keep wrote: Sean Kelly wrote: Daniel Keep wrote: Andrei Alexandrescu wrote: Denis Koroskin wrote: [snip] get/set/free? With these you can't move a resource inside the property. Andrei Python has an overload for removing properties. In all my years of using Python, I've *NEVER* on

Re: ref returns and properties

2009-01-26 Thread dsimcha
== Quote from Daniel Keep (daniel.keep.li...@gmail.com)'s article > Sean Kelly wrote: > > Daniel Keep wrote: > >> Andrei Alexandrescu wrote: > >>> Denis Koroskin wrote: > [snip] > > get/set/free? > >>> With these you can't move a resource inside the property. > >>> > >>> Andrei > >>

Re: ref returns and properties

2009-01-26 Thread John Reimer
Hello dsimcha, == Quote from Daniel Keep (daniel.keep.li...@gmail.com)'s article Sean Kelly wrote: Daniel Keep wrote: Andrei Alexandrescu wrote: Denis Koroskin wrote: [snip] get/set/free? With these you can't move a resource inside the property. Andrei Python has an overload for

Re: ref returns and properties

2009-01-26 Thread Steven Schveighoffer
"Andrei Alexandrescu" wrote >I realized that properties are not a complete model for actual data. The >current conventional wisdom about properties goes like this (T is some >type): > > class Host > { > property prop > { > T get() { ... } > void set(T value) { ... } >

Re: range and algorithm-related stuff

2009-01-26 Thread Andrei Alexandrescu
bearophile wrote: Andrei Alexandrescu: You can take a look at my dlibs, they may give you ideas, because contain all such lazy functions and some more. You mean the libs in my signature? Sure. :o) In http://www.fantascienza.net/leonardo/so/dlibs/func.html, I like functions such as any and all

Re: ref returns and properties

2009-01-26 Thread Sean Kelly
Don wrote: Andrei Alexandrescu wrote: Jacob Carlborg wrote: [on properties] What about this: class Host { property acquire release prop { T get(); } } And then the compiler will automatically created the "acquire" and "release" methods. There could also be what I wo

Re: range and algorithm-related stuff

2009-01-26 Thread Steven Schveighoffer
"Andrei Alexandrescu" wrote > Steven Schveighoffer wrote: >> "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

Re: range and algorithm-related stuff

2009-01-26 Thread bearophile
Andrei Alexandrescu: > You mean the libs in my signature? Sure. :o) :-] > I like frequency a > lot, would be very useful for my NLP code (although probably I'd replace > it with counts and let the user normalize). It doesn't perform a normalization (I can add to it few more functionalities

Re: range and algorithm-related stuff

2009-01-26 Thread bearophile
bearophile: > and sometimes not even much intelligent. I meant: "sometimes not even much interesting."

Re: Checked oveflows in C#

2009-01-26 Thread Nick Sabalausky
"bearophile" wrote in message news:glk5pj$22r...@digitalmars.com... > It seems one group of ideas and syntax I did suggest for D weren't so > Krazy, after all. I have just found that they can be seen almost equal in > C#. > > You can read something about them here: > http://msdn.microsoft.com/e

Re: Glibc hell

2009-01-26 Thread Spacen Jasset
Steven Schveighoffer wrote: "Spacen Jasset" wrote Steven Schveighoffer wrote: ...chop For us Linux DMD users a bug should be raised against dmd so that Walter will hopefully compile against an older glibc on future releases. As long as it doesn't cause weird problems. I have had weird stu

Re: Glibc hell

2009-01-26 Thread Spacen Jasset
Walter Bright wrote: Spacen Jasset wrote: For us Linux DMD users a bug should be raised against dmd so that Walter will hopefully compile against an older glibc on future releases. Yet when I do that the other half of the linux users have a problem. Do you know what problems they had Walter,

Re: range and algorithm-related stuff

2009-01-26 Thread Andrei Alexandrescu
bearophile wrote: Andrei Alexandrescu: I like frequency a lot, would be very useful for my NLP code (although probably I'd replace it with counts and let the user normalize). It doesn't perform a normalization (I can add to it few more functionalities can be added, but not this one), I'll impr

Re: ref returns and properties

2009-01-26 Thread Yigal Chripun
Jacob Carlborg wrote: Andrei Alexandrescu wrote: Michiel Helvensteijn wrote: Andrei Alexandrescu wrote: void move(ref T src, ref T dst); void swap(ref T lhs, ref T rhs); ... But if "prop" is a property with get and set, everything falls apart. Properties effectively hide the address of the

Re: Could we get a LP64 version identifier?

2009-01-26 Thread Walter Bright
Jacob Carlborg wrote: Are you saying that D_LP64 isn't implemented in the current version? Because I noticed that it was already listed in the documentation: http://www.digitalmars.com/d/1.0/version.html When I tried to set the D_LP64 version with GDC it said: "Error: version identifier 'D_LP64

Re: Nothrow, pure in druntime

2009-01-26 Thread Walter Bright
Don wrote: Walter Bright wrote: Don wrote: tango.math doesn't use the C library at all, except when inline asm is unavailable. Of they differ from the C functions, in that none of them set errno! One really annoying issue still remains, though -- the floating point flags in the CPU. They are

Re: Could we get a LP64 version identifier?

2009-01-26 Thread Walter Bright
Frits van Bommel wrote: Some testing shows that all DMD-frontend based compilers (i.e. DMD, GDC and LDC) seem to produce that error message for any version identifier starting with "D_" (Including "D_" itself). The point of that is to ensure that the D_ name space is reserved for predefined v

Re: Could we get a LP64 version identifier?

2009-01-26 Thread Walter Bright
Frits van Bommel wrote: [1]: Hey, x86 technically has 6-byte pointers if you count segments as part of the pointer (which would be mostly useless on currently popular operating systems though). It does, but I know of no compiler that supports that (C, C++, or any other), and code that needs t

Re: range and algorithm-related stuff

2009-01-26 Thread Andrei Alexandrescu
Steven Schveighoffer wrote: "Andrei Alexandrescu" wrote If Retro.empty is const and Range.empty is not, that won't compile. If Retro.empty is non-const and Range.empty is const, it will compile, but passing a const Retro won't work as well as passing a const Range. Hm... you need the template

Re: range and algorithm-related stuff

2009-01-26 Thread Denis Koroskin
Steven Schveighoffer Wrote: > "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 functi

Re: ref returns and properties

2009-01-26 Thread Andrei Alexandrescu
Steven Schveighoffer wrote: "Andrei Alexandrescu" wrote I realized that properties are not a complete model for actual data. The current conventional wisdom about properties goes like this (T is some type): class Host { property prop { T get() { ... } void set(T value)

Re: ref returns and properties

2009-01-26 Thread Steven Schveighoffer
"Andrei Alexandrescu" wrote > Steven Schveighoffer wrote: >> There are two possibilities that I can think of. >> >> 1. ref return from get, which gets you part-way there. You can still do >> some useful things like which member you are returning getting >> calculated, but it doesn't make the cal

Re: ref returns and properties

2009-01-26 Thread Andrei Alexandrescu
Steven Schveighoffer wrote: I guess I'm not really sure what the "acquire" method does. I saw you mention it in another post, but with no explanation as to what it actually does, just that it was needed. I'm sure I'm not getting what should be obvious, but if you could enlighten, I would appr

Re: ref returns and properties

2009-01-26 Thread Steven Schveighoffer
"Andrei Alexandrescu" wrote > Steven Schveighoffer wrote: >> I guess I'm not really sure what the "acquire" method does. I saw you >> mention it in another post, but with no explanation as to what it >> actually does, just that it was needed. I'm sure I'm not getting what >> should be obvious,

Re: ref returns and properties

2009-01-26 Thread Denis Koroskin
On Tue, 27 Jan 2009 01:52:26 +0300, Steven Schveighoffer wrote: "Andrei Alexandrescu" wrote Steven Schveighoffer wrote: I guess I'm not really sure what the "acquire" method does. I saw you mention it in another post, but with no explanation as to what it actually does, just that it was nee

Re: Checked oveflows in C#

2009-01-26 Thread Denis Koroskin
On Mon, 26 Jan 2009 20:54:38 +0300, Nick Sabalausky wrote: "bearophile" wrote in message news:glk5pj$22r...@digitalmars.com... It seems one group of ideas and syntax I did suggest for D weren't so Krazy, after all. I have just found that they can be seen almost equal in C#. You can read s

Re: range and algorithm-related stuff

2009-01-26 Thread Denis Koroskin
On Mon, 26 Jan 2009 23:37:25 +0300, Denis Koroskin <2kor...@gmail.com> wrote: Steven Schveighoffer Wrote: "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 opi

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: ref returns and properties

2009-01-26 Thread Andrei Alexandrescu
Sergey Gromov wrote: 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

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 working on the new range stuff and the range-based algorithm. In > all

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

Re: range and algorithm-related stuff

2009-01-26 Thread Steven Schveighoffer
"Denis Koroskin" wrote > On Mon, 26 Jan 2009 23:37:25 +0300, Denis Koroskin <2kor...@gmail.com> > wrote: >> Checking if a range is empty() prior to accessing its head is useful. If >> empty() is const, you can't do that. > > Err.. if empty() is not const and you have a const range reference. emp

Re: ref returns and properties

2009-01-26 Thread Steven Schveighoffer
"Denis Koroskin" wrote > On Tue, 27 Jan 2009 01:52:26 +0300, Steven Schveighoffer > wrote: > >> "Andrei Alexandrescu" wrote >>> Steven Schveighoffer wrote: I guess I'm not really sure what the "acquire" method does. I saw you mention it in another post, but with no explanation as to wh

Re: range and algorithm-related stuff

2009-01-26 Thread Steven Schveighoffer
"Andrei Alexandrescu" wrote > Probably many people would expect to just write this: > > void foo(in SomeRange range) { ... } > > and have foo look at the range and its elements no problem, without > actually iterating through the range. Consider that some type const Range!(T), where T is a refer

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

2009-01-26 Thread Andrei Alexandrescu
Sergey Gromov wrote: 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 s

Re: range and algorithm-related stuff

2009-01-26 Thread Andrei Alexandrescu
Sergey Gromov wrote: 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 working on the new range stuff and the range-based algorithm. In all li

Re: Nothrow, pure in druntime

2009-01-26 Thread Michel Fortin
On 2009-01-26 14:21:18 -0500, Walter Bright said: I guess it's reasonable to argue that using the floating-point flags is sufficiently hard-core that pure and nothrow should pretend that they don't exist. Still, some functions (especially correctly-rounded floating-point i/o) go to a lot of

Re: range and algorithm-related stuff

2009-01-26 Thread bearophile
Andrei Alexandrescu: >Probably array and assign will make the cut as well.< assign() of my libs is an ugly hack, I'd like such feature to be built-in in the language, with the comma syntax: a, b = foo(...) I use such syntax all the time in Python and it's quite handy. Something like my Record/r

Re: range and algorithm-related stuff

2009-01-26 Thread bearophile
I was forgetting, Clojure (the nice lisp variant that works on the JavaVM) also has pmap(), a parallel map() function, that executes the functions in parallel, on different CPU cores. Such stuff can become quite useful in D2 too: http://clojure.org/api#toc571 Bye, bearophile