Re: nothrow function to tell if a string can be converted to a number?

2013-09-06 Thread Jonathan M Davis
On Friday, September 06, 2013 22:38:20 H. S. Teoh wrote: > On Sat, Sep 07, 2013 at 12:38:58AM -0400, Jonathan M Davis wrote: > > On Friday, September 06, 2013 21:15:44 Timothee Cour wrote: > > > I'd like to have a function: > > > > > > @nothrow bool isNumberLitteral(string a); > > > unittest{ > >

Re: nothrow function to tell if a string can be converted to a number?

2013-09-06 Thread H. S. Teoh
On Sat, Sep 07, 2013 at 12:38:58AM -0400, Jonathan M Davis wrote: > On Friday, September 06, 2013 21:15:44 Timothee Cour wrote: > > I'd like to have a function: > > > > @nothrow bool isNumberLitteral(string a); > > unittest{ > > assert(isNumberLitteral("1.2")); > > assert(!isNumberLitteral("a1.2")

Re: nothrow function to tell if a string can be converted to a number?

2013-09-06 Thread Jonathan M Davis
On Friday, September 06, 2013 21:15:44 Timothee Cour wrote: > I'd like to have a function: > > @nothrow bool isNumberLitteral(string a); > unittest{ > assert(isNumberLitteral("1.2")); > assert(!isNumberLitteral("a1.2")); > assert(!isNumberLitteral("a.b")); > } > > I want it nothrow for efficiency

nothrow function to tell if a string can be converted to a number?

2013-09-06 Thread Timothee Cour
I'd like to have a function: @nothrow bool isNumberLitteral(string a); unittest{ assert(isNumberLitteral("1.2")); assert(!isNumberLitteral("a1.2")); assert(!isNumberLitteral("a.b")); } I want it nothrow for efficiency (I'm using it intensively), and try/catch as below has significant runtim

dmd: how to pass several linker options with just one -L? (or feature request)

2013-09-06 Thread Timothee Cour
is there a way to achieve this: dmd -L-lfoo -L-lbar main.d with a single call to -L to pass several linker options; something like: dmd -L'-lfoo -lbar' main.d except that won't work due to '' being treated as one argument. Maybe something like: dmd --L=' flag1 flag2' main.d which would treat the ar

Re: inout method is not callable using a const object

2013-09-06 Thread Jonathan Crapuchettes
On Fri, 06 Sep 2013 14:08:19 -0700, Ali Çehreli wrote: > I think it is the same issue then. > > On 09/06/2013 02:00 PM, Jonathan Crapuchettes wrote: > > >> > inout(DataT*) opIndex(const Address addr) inout { > > Unless Address is an alias of int, there is no matching opIndex overload >

Re: Adding libraries to an executable

2013-09-06 Thread Jonathan M Davis
On Friday, September 06, 2013 23:31:57 Anton Alexeev wrote: > I've written a program which uses curl library. So on a PC > without curl the program will not work until you install the > library. Is there a way to put the curl library in the executable? Statically link it. - Jonathan M Davis

Re: inout method is not callable using a const object

2013-09-06 Thread Ali Çehreli
On 09/06/2013 01:27 PM, Ali Çehreli wrote: the compiler should error about not finding a matching foo() overload instead of bringing the inout into the discussion. http://d.puremagic.com/issues/show_bug.cgi?id=10982 Ali

Adding libraries to an executable

2013-09-06 Thread Anton Alexeev
I've written a program which uses curl library. So on a PC without curl the program will not work until you install the library. Is there a way to put the curl library in the executable?

Re: [Font] Getting font folder on all platforms

2013-09-06 Thread Flamaros
On Friday, 6 September 2013 at 16:05:43 UTC, Tourist wrote: On Thursday, 5 September 2013 at 19:48:07 UTC, Flamaros wrote: I am searching the right way to find fonts folder for each platforms (Windows, linux, macOS X) On Windows it's generally "C:\Windows\Fonts" but a direct access seems brut

Re: inout method is not callable using a const object

2013-09-06 Thread Jonathan Crapuchettes
On Fri, 06 Sep 2013 13:27:20 -0700, Ali Çehreli wrote: > On 09/06/2013 01:14 PM, Jonathan Crapuchettes wrote: > > > Can someone help me understand how to correct this error? > > > > Error: inout method ...ValidSparseDataStore.opIndex is not callable > > using a const object > > That error is

Re: inout method is not callable using a const object

2013-09-06 Thread Ali Çehreli
I think it is the same issue then. On 09/06/2013 02:00 PM, Jonathan Crapuchettes wrote: >> > inout(DataT*) opIndex(const Address addr) inout { Unless Address is an alias of int, there is no matching opIndex overload for the following call: >auto dp = cStore[16057];//<-- ER

Re: Defining inout returned values for ranges

2013-09-06 Thread Jonathan Crapuchettes
On Thu, 05 Sep 2013 23:32:10 +0200, anonymous wrote: > On Thursday, 5 September 2013 at 19:19:42 UTC, Jonathan Crapuchettes > wrote: >> On Wed, 04 Sep 2013 11:49:41 +0200, anonymous wrote: > [...] >>> You can use a Template This Parameter [1] instead of inout: >>> >>> auto opSlice(this Th

inout method is not callable using a const object

2013-09-06 Thread Jonathan Crapuchettes
Can someone help me understand how to correct this error? Error: inout method ...ValidSparseDataStore.opIndex is not callable using a const object The specific method is defined as: struct ValidSparseDataStore { inout(DataT*) opIndex(const Address addr) inout { if (auto node = f

Re: inout method is not callable using a const object

2013-09-06 Thread Ali Çehreli
On 09/06/2013 01:14 PM, Jonathan Crapuchettes wrote: > Can someone help me understand how to correct this error? > > Error: inout method ...ValidSparseDataStore.opIndex is not callable using > a const object That error is about opIndex but we don't see any code that makes that call. > The speci

Re: How would I sort an associative array by value?

2013-09-06 Thread H. S. Teoh
On Fri, Sep 06, 2013 at 08:58:48AM +0200, Ludovit Lucenic wrote: > On Friday, 29 June 2012 at 18:00:06 UTC, Timon Gehr wrote: > >On 06/29/2012 07:52 PM, ixid wrote: > >>Or more generally does D have a library function so I can sort one > >>array based on sorting the contents of another? > > > >sort

Re: [Font] Getting font folder on all platforms

2013-09-06 Thread Tourist
On Thursday, 5 September 2013 at 19:48:07 UTC, Flamaros wrote: I am searching the right way to find fonts folder for each platforms (Windows, linux, macOS X) On Windows it's generally "C:\Windows\Fonts" but a direct access seems brutal, it's certainly expected to retrieve this path by using s

Re: PyD status and tutorials

2013-09-06 Thread Johannes Pfau
Am Thu, 05 Sep 2013 04:49:04 +0200 schrieb "Ellery Newcomer" : > > Since I've been out of the loop for a while, can gdc build shared > libraries yet? That's what OP's build command is trying to do. Unfortunately no. Although the relocation error looks like a regression we never had runtime supp

Re: How would I sort an associative array by value?

2013-09-06 Thread Ludovit Lucenic
On Friday, 29 June 2012 at 18:00:06 UTC, Timon Gehr wrote: On 06/29/2012 07:52 PM, ixid wrote: Or more generally does D have a library function so I can sort one array based on sorting the contents of another? sort!"a[0]This sorts both ranges in-place based on the contents of the first range