Re: Shared pain

2014-02-19 Thread HeiHon
On Friday, 19 November 2010 at 06:53:40 UTC, Steve Teale wrote: On Thu, 18 Nov 2010 11:26:39 +, Steve Teale wrote: I had D code that provided a basis for creation of Windows services, which I have just tried to get working with the latest D2. No dice. I have made some progress in underst

Re: Shared pain

2010-11-19 Thread Steve Teale
On Fri, 19 Nov 2010 16:21:41 -0500, Jason House wrote: > Steve Teale Wrote: > >> On Fri, 19 Nov 2010 08:25:17 -0500, Jason House wrote: >> >> > A cast to immutable is required when constructing immutable objects. >> > The type system can't prove that's safe. It's a design limitation to >> > keep

Re: Shared pain

2010-11-19 Thread Jason House
Steve Teale Wrote: > On Fri, 19 Nov 2010 08:25:17 -0500, Jason House wrote: > > > A cast to immutable is required when constructing immutable objects. The > > type system can't prove that's safe. It's a design limitation to keep > > complexity low. > > > Jason, > > But design limitations like t

Re: Shared pain

2010-11-19 Thread bearophile
Steve Teale: > I admire your dedication to language theory and purity, but there are > many who'd translate that to impracticality and obscurity. I like that idea about immutables & strong pure functions, but it was not an idea of mine :-) That enhancement request in Bugzilla is not written by

Re: Shared pain

2010-11-19 Thread Fawzi Mohamed
On 19-nov-10, at 17:42, Steve Teale wrote: On Fri, 19 Nov 2010 11:23:44 -0500, bearophile wrote: Regarding the creation of immutable data structures, there is a proposal that is probably able to remove some of the pain: the result of strongly pure functions may become implicitly castable

Re: Shared pain

2010-11-19 Thread Steve Teale
On Fri, 19 Nov 2010 11:23:44 -0500, bearophile wrote: > Regarding the creation of immutable data structures, there is a proposal > that is probably able to remove some of the pain: the result of strongly > pure functions may become implicitly castable to immutable. > > Bye, > bearophile BP, I a

Re: windows debug [Shared pain]

2010-11-19 Thread Stanislav Blinov
19.11.2010 19:08, Steve Teale пишет: On Fri, 19 Nov 2010 16:58:26 +0300, Stanislav Blinov wrote: Have you tried OutputDebugString()? It's WinAPI function that sends strings to the 'debugger'. DebugView application from SysInternals suite nicely prints those strings, and also times them. How is

Re: Shared pain

2010-11-19 Thread bearophile
Steve Teale: > Languages can't be designed just on theory - some recognition of > practicality is also required. In the case of creation of immutable data structures it looks the opposite to me: DMD is too much pragmatic and there isn't enough theory behind it :-) > But design limitations lik

Re: windows debug [Shared pain]

2010-11-19 Thread Steve Teale
On Fri, 19 Nov 2010 16:58:26 +0300, Stanislav Blinov wrote: > Have you tried OutputDebugString()? It's WinAPI function that sends > strings to the 'debugger'. DebugView application from SysInternals suite > nicely prints those strings, and also times them. How is this better than the event log. I

Re: Shared pain

2010-11-19 Thread Steve Teale
On Fri, 19 Nov 2010 08:25:17 -0500, Jason House wrote: > A cast to immutable is required when constructing immutable objects. The > type system can't prove that's safe. It's a design limitation to keep > complexity low. > Jason, But design limitations like that will force programmers who are on

windows debug [Shared pain]

2010-11-19 Thread Stanislav Blinov
18.11.2010 21:53, Steve Teale пишет: As you can imagine, this is terrible to debug - printf or similar is bad enough, but for the service I'm pushing entries into the Windows event logger system. [...] But first I think I'll stop and do some carpentry for a couple of days. Then eventually someth

Re: Shared pain

2010-11-19 Thread Jason House
A cast to immutable is required when constructing immutable objects. The type system can't prove that's safe. It's a design limitation to keep complexity low. http://www.digitalmars.com/d/2.0/phobos/std_regexp.html Looking at the Regexp docs, find isn't marked const or pure. If that's an oversit

Re: Shared pain

2010-11-19 Thread Steven Schveighoffer
On Fri, 19 Nov 2010 01:49:30 -0500, Steve Teale wrote: As I said before, I don't know if the thread being created by the windows service procedure is properly initializing the D modules of the library/runtime. Try as the first line of ServiceMain to initialize the current thread: auto myt

Re: Shared pain

2010-11-18 Thread Steve Teale
On Thu, 18 Nov 2010 11:26:39 +, Steve Teale wrote: > I had D code that provided a basis for creation of Windows services, > which I have just tried to get working with the latest D2. > > No dice. > I have made some progress in understanding this. It appears that any D static data structures

Re: Shared pain

2010-11-18 Thread Steve Teale
> As I said before, I don't know if the thread being created by the > windows service procedure is properly initializing the D modules of the > library/runtime. Try as the first line of ServiceMain to initialize the > current thread: > > auto mythread = thread_attachThis(); > > see http://www.d

Re: Shared pain

2010-11-18 Thread Steven Schveighoffer
On Thu, 18 Nov 2010 13:53:53 -0500, Steve Teale wrote: On Thu, 18 Nov 2010 08:33:12 -0500, Steven Schveighoffer wrote: I think using a class in D is a good idea. But what you may need is global functions which forward to your class methods. This is how I would probably do it. -Steve S

Re: Shared pain

2010-11-18 Thread Steve Teale
On Thu, 18 Nov 2010 08:33:12 -0500, Steven Schveighoffer wrote: > > I think using a class in D is a good idea. But what you may need is > global functions which forward to your class methods. This is how I > would probably do it. > > -Steve Steve, Thanks. I kind of went that way. Having done

Re: Shared pain

2010-11-18 Thread Steven Schveighoffer
On Thu, 18 Nov 2010 06:26:39 -0500, Steve Teale wrote: I had D code that provided a basis for creation of Windows services, which I have just tried to get working with the latest D2. No dice. The point of failure was in this method static void StartService() { if (!StartServiceCtrlDis

Re: Shared pain

2010-11-18 Thread Jason House
I'm not familiar with the API, but are you able to declare your original _sta as immutable and call it a day? Immutable data should have the same protection as __gshared but with no implications of bypassing the type system. If that's not helpful, can you give more details like calling patterns?

Shared pain

2010-11-18 Thread Steve Teale
I had D code that provided a basis for creation of Windows services, which I have just tried to get working with the latest D2. No dice. The point of failure was in this method static void StartService() { if (!StartServiceCtrlDispatcherA(cast(SERVICE_TABLE_ENTRY *) &_sta[0])) { ...