Re: ushort arithmetic question

2013-10-25 Thread Jonathan Crapuchettes
On Fri, 25 Oct 2013 11:51:03 -0700, Ali Çehreli wrote: > On 10/25/2013 11:45 AM, Jonathan Crapuchettes wrote: >> Shouldn't this code work? Looking at the arithmetic conversions section >> of http://dlang.org/type.html, point 4.1 makes me think that I >> shouldn't

ushort arithmetic question

2013-10-25 Thread Jonathan Crapuchettes
Shouldn't this code work? Looking at the arithmetic conversions section of http://dlang.org/type.html, point 4.1 makes me think that I shouldn't be getting the error since they are the same type. void main() { ushort v1 = 1; ushort v2 = 1; ushort v3 = v1 + v2; } test.d(5): Error: ca

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 i

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

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: >>&g

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: Defining inout returned values for ranges

2013-09-05 Thread Jonathan Crapuchettes
On Wed, 04 Sep 2013 11:49:41 +0200, anonymous wrote: > On Wednesday, 4 September 2013 at 00:56:39 UTC, Jonathan Crapuchettes > wrote: >> If a range struct (Range) is defined inside another struct (Test), how >> can the constness or mutability of Test be attributed to the

Defining inout returned values for ranges

2013-09-03 Thread Jonathan Crapuchettes
If a range struct (Range) is defined inside another struct (Test), how can the constness or mutability of Test be attributed to the return type of Range.front? I'm running into this problem because I need the range to be iterated, but I need the pointer in T to be marked const when appropriate.

Re: Templated Function can't deduce function arguments

2013-05-23 Thread Jonathan Crapuchettes
Thank you for the help. Bug report at http://d.puremagic.com/issues/ show_bug.cgi?id=10156

Re: Templated Function can't deduce function arguments

2013-05-23 Thread Jonathan Crapuchettes
On Wed, 22 May 2013 23:28:21 -0400, Jonathan M Davis wrote: > On Wednesday, May 22, 2013 21:31:53 Steven Schveighoffer wrote: >> On Wed, 22 May 2013 21:16:44 -0400, Jonathan Crapuchettes >> >> wrote: >> > Can anyone tell me why this doesn't compile? Dmd 2.062

Templated Function can't deduce function arguments

2013-05-22 Thread Jonathan Crapuchettes
Can anyone tell me why this doesn't compile? Dmd 2.062 says that it cannot deduce the template function from arguments types. import std.stdio; void main() { test!(dchar, int)('b', 6, 'a', 54); } template test(Types...) { void test(T...)(const Types v, const T values...) {

Re: Named Tuple Names

2013-03-26 Thread Jonathan Crapuchettes
On Tue, 26 Mar 2013 10:13:03 +0100, Jacob Carlborg wrote: > On 2013-03-25 23:58, Jonathan Crapuchettes wrote: >> Is there a way to get the names of the fields in a named tuple? It >> looks like the names are actually aliases. > > Perhaps "fieldSpecs". Well, tha

Named Tuple Names

2013-03-25 Thread Jonathan Crapuchettes
Is there a way to get the names of the fields in a named tuple? It looks like the names are actually aliases. Thanks, JC

Re: Function constraint vs const parameter?

2012-06-07 Thread Jonathan Crapuchettes
That worked great! I wish there was a simpler solution, but thank you very much for your help. JC Ali Çehreli wrote: On 06/06/2012 10:02 AM, Jonathan Crapuchettes wrote: > I'm running into a problem with the following function definition when > passing in a const(string[]). &g

Function constraint vs const parameter?

2012-06-06 Thread Jonathan Crapuchettes
I'm running into a problem with the following function definition when passing in a const(string[]). public T condenseCountyList(T)(const T inputList) if (is(Unqual!T : string) || is(Unqual!T : string[])) I'm getting the "Error: template common.condenseCountyList does not match any function

Re: Global runtime strings help

2011-09-26 Thread Jonathan Crapuchettes
:29:08 Jonathan Crapuchettes wrote: I'm working on an application that requires a large number of strings that only need to be loaded once at runtime and need to be accessible to all threads throughout the execution of the program. Some of these strings are variables like database host and use

Global runtime strings help

2011-09-23 Thread Jonathan Crapuchettes
I'm working on an application that requires a large number of strings that only need to be loaded once at runtime and need to be accessible to all threads throughout the execution of the program. Some of these strings are variables like database host and username that need to be read from a file

Re: Synchronized Linked List Traversal

2010-01-21 Thread Jonathan Crapuchettes
Yeah, but I have a lot of code in this project that uses phobos and it would be a major pain (not to mention the time) to switch over. Thank you for the thought, Jonathan Steven Schveighoffer wrote: On Thu, 21 Jan 2010 13:29:37 -0500, Jonathan Crapuchettes wrote: Thank you for the help

Re: Synchronized Linked List Traversal

2010-01-21 Thread Jonathan Crapuchettes
Thank you for the help. Since I am using D1, I think I will use the pthread mutexes through the C API. Steven Schveighoffer wrote: On Thu, 21 Jan 2010 08:35:50 -0500, Steven Schveighoffer wrote: To do this, you need a manual mutex, look in tango.core.sync.Mutex I think. or core.sync.mutex

Synchronized Linked List Traversal

2010-01-20 Thread Jonathan Crapuchettes
I'm working on a project that requires multi-threading and I am trying to grasp the best way to work with setting up a linked-list where multiple threads might try to be setting the next element in the list at the same time. What I really need to know is if this will work: Node!(T) child = par

UNIX IPC Sockets

2009-03-02 Thread Jonathan Crapuchettes
I am looking into doing some IPC between two processes using phobos, but ran into a problem when trying to bind a Socket to a unix location. There is an InternetAddress class, but there doesn't appear to be an Address class for the UNIX address family. Can anyone give me an example of how to set