Daemonize v0.1 - simple way to create cross-platform daemons
Finally I've finished library for wrapping applications into daemons or services (Windows). The library hides platform-specific boilerplate behind compile-time API: ``` // First you need to describe your daemon via template alias daemon = Daemon!( DaemonizeExample1, // unique name // Setting associative map signal - callbacks KeyValueList!( // You can bind same delegate for several signals by Composition template // delegate can take additional argument to know which signal is caught Composition!(Signal.Terminate, Signal.Quit, Signal.Shutdown, Signal.Stop), (logger, signal) { logger.logInfo(Exiting...); return false; // returning false will terminate daemon }, Signal.HangUp, (logger) { logger.logInfo(Hello World!); return true; // continue execution } ), // Main function where your code is (logger, shouldExit) { // will stop the daemon in 5 minutes auto time = Clock.currSystemTick + cast(TickDuration)5.dur!minutes; while(!shouldExit() time Clock.currSystemTick) { } return 0; } ); int main() { return buildDaemon!daemon.run(new shared StrictLogger(logfile.log)); } ``` At the moment daemonize has following features: * Daemons for GNU/Linux, services for Windows * Custom signals * Signal composition * Client for sending signals to defined daemons * Auto installing and uninstalling for Windows services * Usage of .pid and .lock files (GNU/Linux) * Privileges lowing (GNU/Linux) Daemonize operates well with vibe.d (example - https://github.com/NCrashed/daemonize/tree/master/examples/03.Vibed) P.S. At the moment library doesn't support Mac and other Posix systems, the support is going to be added at next releases.
Re: Daemonize v0.1 - simple way to create cross-platform daemons
On Sun, 31 Aug 2014 11:27:41 + NCrashed via Digitalmars-d-announce digitalmars-d-announce@puremagic.com wrote: looks very interesting, thank you. signature.asc Description: PGP signature
Re: Daemonize v0.1 - simple way to create cross-platform daemons
Nice! I have a few questions/remarks, mainly to simplify the API somewhat. Please bear with me :-) // First you need to describe your daemon via template alias daemon = Daemon!( DaemonizeExample1, // unique name Does the user sees/uses this name in any way afterwards? Because I think you could also produce a unique string at compile-time (by using __FILE__ and __LINE__, unless someone has a better idea), if the user does not provide one. Maybe he just wants an anonymous daemon, or doesn't care, whatever. // Setting associative map signal - callbacks KeyValueList!( If I understand correctly, the Daemon template waits for a list of (at least one) Signal, then a delegate, then some more Signals, another delegate, and so on? If that's so I think you could ditch KeyValueList (or build it invisibly to the user) and let the user write only the signals and delegates: alias daemon = Daemon!( Signal.Terminate, Signal.Quit, Signal.Shutdown, Signal.Stop, (logger, signal) { ...}, Signal.Hangup, (logger) { ...} ... ); Iterate the argument list, collecting Signals. When you hit a delegate, create a Composition!( ... ) with the previous signals, jump above the delegate and so on. Is the idea that, if the delegate has two arguments, then the second is the signal that will be passed to it, and if it has only one argument, only the logger will be passed? What if the user does not want a logger? Is a daemon always associated to a log file in OSes? // Main function where your code is (logger, shouldExit) { // will stop the daemon in 5 minutes auto time = Clock.currSystemTick + cast(TickDuration)5.dur!minutes; while(!shouldExit() time Clock.currSystemTick) { } return 0; } Is the main function always the last delegate? Concerning the DaemonClient template, could you not ask for Daemon to generate it on demand? Or is DaemonClient always used in another module? Because, given a Daemon, extracting the simplified DaemonClient can be done, I think. * Custom signals enum Signal : string { ... } @nogc Signal customSignal(string name) @safe pure nothrow { return cast(Signal)name; } I didn't know you could have an enum and extend it with a cast like this. Wow. * Signal composition What happens when an unhandled signal is passed to a daemon? P.S. At the moment library doesn't support Mac and other Posix systems, the support is going to be added at next releases. Do you foresee any difficulty in adapting this to Mac?
Re: Daemonize v0.1 - simple way to create cross-platform daemons
Thanks a lot for the respond! Does the user sees/uses this name in any way afterwards? Because I think you could also produce a unique string at compile-time (by using __FILE__ and __LINE__, unless someone has a better idea), if the user does not provide one. Maybe he just wants an anonymous daemon, or doesn't care, whatever. Yes, the name is used in windows service manager (you can start/stop the daemon by control panel) and for default locations of .pid and .lock files. Auto generated name will prevent sending signals and could be ugly displayed in service manager. The feature is useful for simple daemons, I will play around with that idea to find out if it worth. If I understand correctly, the Daemon template waits for a list of (at least one) Signal, then a delegate, then some more Signals, another delegate, and so on? If that's so I think you could ditch KeyValueList (or build it invisibly to the user) and let the user write only the signals and delegates: alias daemon = Daemon!( Signal.Terminate, Signal.Quit, Signal.Shutdown, Signal.Stop, (logger, signal) { ...}, Signal.Hangup, (logger) { ...} ... ); Iterate the argument list, collecting Signals. When you hit a delegate, create a Composition!( ... ) with the previous signals, jump above the delegate and so on. I will add the approach in next release (it requires some more additional templates to wrap all the mess) thanks to arguments grammar has no ambiguities. Is the idea that, if the delegate has two arguments, then the second is the signal that will be passed to it, and if it has only one argument, only the logger will be passed? Yes What if the user does not want a logger? Is a daemon always associated to a log file in OSes? It is a general rule as the stderr and stdout files are closed. At next version I want to use duck typing for logger (or sink approach same as toString uses) and add a feature to reopen stderr/stdout to another file. Is the main function always the last delegate? Yes Concerning the DaemonClient template, could you not ask for Daemon to generate it on demand? Or is DaemonClient always used in another module? DaemonClient is designed to be used in another module, you can send signals with full Daemon template. What happens when an unhandled signal is passed to a daemon? The event is logged down and ignored. Do you foresee any difficulty in adapting this to Mac? All logic should be the same as for linux, I just don't have any machine to test all out. I hope virtual machine will help. On Sunday, 31 August 2014 at 16:01:10 UTC, Philippe Sigaud via Digitalmars-d-announce wrote: Nice! I have a few questions/remarks, mainly to simplify the API somewhat. Please bear with me :-) // First you need to describe your daemon via template alias daemon = Daemon!( DaemonizeExample1, // unique name Does the user sees/uses this name in any way afterwards? Because I think you could also produce a unique string at compile-time (by using __FILE__ and __LINE__, unless someone has a better idea), if the user does not provide one. Maybe he just wants an anonymous daemon, or doesn't care, whatever. // Setting associative map signal - callbacks KeyValueList!( If I understand correctly, the Daemon template waits for a list of (at least one) Signal, then a delegate, then some more Signals, another delegate, and so on? If that's so I think you could ditch KeyValueList (or build it invisibly to the user) and let the user write only the signals and delegates: alias daemon = Daemon!( Signal.Terminate, Signal.Quit, Signal.Shutdown, Signal.Stop, (logger, signal) { ...}, Signal.Hangup, (logger) { ...} ... ); Iterate the argument list, collecting Signals. When you hit a delegate, create a Composition!( ... ) with the previous signals, jump above the delegate and so on. Is the idea that, if the delegate has two arguments, then the second is the signal that will be passed to it, and if it has only one argument, only the logger will be passed? What if the user does not want a logger? Is a daemon always associated to a log file in OSes? // Main function where your code is (logger, shouldExit) { // will stop the daemon in 5 minutes auto time = Clock.currSystemTick + cast(TickDuration)5.dur!minutes; while(!shouldExit() time Clock.currSystemTick) { } return 0; } Is the main function always the last delegate? Concerning the DaemonClient template, could you not ask for Daemon to generate it on demand? Or is DaemonClient always used in another module? Because, given a Daemon, extracting the simplified DaemonClient can be done, I think. * Custom signals enum Signal : string { ... } @nogc Signal customSignal(string name) @safe pure nothrow { return cast(Signal)name; } I didn't know you could have an enum and extend it with a cast like this. Wow. *
Re: Daemonize v0.1 - simple way to create cross-platform daemons
Does the user sees/uses this name in any way afterwards? Because I think you could also produce a unique string at compile-time (by using __FILE__ and __LINE__, unless someone has a better idea), if the user does not provide one. Maybe he just wants an anonymous daemon, or doesn't care, whatever. Yes, the name is used in windows service manager (you can start/stop the daemon by control panel) and for default locations of .pid and .lock files. OK. Auto generated name will prevent sending signals and could be ugly displayed in service manager. The feature is useful for simple daemons, I will play around with that idea to find out if it worth. Great. I will add the approach in next release (it requires some more additional templates to wrap all the mess) thanks to arguments grammar has no ambiguities. Yes, the grammar is simple, use it to simplify the life of your users. Is the idea that, if the delegate has two arguments, then the second is the signal that will be passed to it, and if it has only one argument, only the logger will be passed? Yes OK. IIRC, I read in your code that composed signals means the next delegate must have the (logger, signal) {...} form. Why? What if the user does not want a logger? Is a daemon always associated to a log file in OSes? It is a general rule as the stderr and stdout files are closed. At next version I want to use duck typing for logger (or sink approach same as toString uses) and add a feature to reopen stderr/stdout to another file. OK. Concerning the DaemonClient template, could you not ask for Daemon to generate it on demand? Or is DaemonClient always used in another module? DaemonClient is designed to be used in another module, you can send signals with full Daemon template. OK. I'd have thought that just having the name of the daemon would be enough to send it signals. What happens when an unhandled signal is passed to a daemon? The event is logged down and ignored. Is that the standard behavior for daemons in OSes? You could have the daemon stopped, after logging the unhandled signal. Or you could also block compilation if a daemon does not handle all signals... Or have a 'catch-all' delegate, as std.concurrency.receive, which uses a (Variant v) {...} delegate at the end. See: http://dlang.org/library/std/concurrency/receive.html (btw, signals could also be types and you could have a handling syntax similar to receive).
Re: Daemonize v0.1 - simple way to create cross-platform daemons
IIRC, I read in your code that composed signals means the next delegate must have the (logger, signal) {...} form. Why? I can (not must) have the form, the delegate params are tested independently from signal composition. Is that the standard behavior for daemons in OSes? Most signals are simply ignored (except termination ones). You could have the daemon stopped, after logging the unhandled signal. Or you could also block compilation if a daemon does not handle all signals... Some signals could be sent without any reason: sighup or interrogate in windows. Ignoring most signals is a better strategy, the exception could be done for terminating signals - their default handlers should set `shouldExit` flag to true. Or have a 'catch-all' delegate, as std.concurrency.receive, which uses a (Variant v) {...} delegate at the end. See: http://dlang.org/library/std/concurrency/receive.html Good idea, it will be implemented. (btw, signals could also be types and you could have a handling syntax similar to receive). Ohh, that is much more complicated feature as it may seem. Signaling in both OSes are very limited. We need an additional channel to pass arbitrary memory between processes and also restrict data to be serializable. If I continue to move in that direction, the D will occasionally obtain a library for distributed cluster computing (like Cloud Haskell) ;). On Sunday, 31 August 2014 at 19:45:32 UTC, Philippe Sigaud via Digitalmars-d-announce wrote: Does the user sees/uses this name in any way afterwards? Because I think you could also produce a unique string at compile-time (by using __FILE__ and __LINE__, unless someone has a better idea), if the user does not provide one. Maybe he just wants an anonymous daemon, or doesn't care, whatever. Yes, the name is used in windows service manager (you can start/stop the daemon by control panel) and for default locations of .pid and .lock files. OK. Auto generated name will prevent sending signals and could be ugly displayed in service manager. The feature is useful for simple daemons, I will play around with that idea to find out if it worth. Great. I will add the approach in next release (it requires some more additional templates to wrap all the mess) thanks to arguments grammar has no ambiguities. Yes, the grammar is simple, use it to simplify the life of your users. Is the idea that, if the delegate has two arguments, then the second is the signal that will be passed to it, and if it has only one argument, only the logger will be passed? Yes OK. IIRC, I read in your code that composed signals means the next delegate must have the (logger, signal) {...} form. Why? What if the user does not want a logger? Is a daemon always associated to a log file in OSes? It is a general rule as the stderr and stdout files are closed. At next version I want to use duck typing for logger (or sink approach same as toString uses) and add a feature to reopen stderr/stdout to another file. OK. Concerning the DaemonClient template, could you not ask for Daemon to generate it on demand? Or is DaemonClient always used in another module? DaemonClient is designed to be used in another module, you can send signals with full Daemon template. OK. I'd have thought that just having the name of the daemon would be enough to send it signals. What happens when an unhandled signal is passed to a daemon? The event is logged down and ignored. Is that the standard behavior for daemons in OSes? You could have the daemon stopped, after logging the unhandled signal. Or you could also block compilation if a daemon does not handle all signals... Or have a 'catch-all' delegate, as std.concurrency.receive, which uses a (Variant v) {...} delegate at the end. See: http://dlang.org/library/std/concurrency/receive.html (btw, signals could also be types and you could have a handling syntax similar to receive).
Re: Daemonize v0.1 - simple way to create cross-platform daemons
On Sunday, 31 August 2014 at 16:01:10 UTC, Philippe Sigaud via Digitalmars-d-announce wrote: * Custom signals enum Signal : string { ... } @nogc Signal customSignal(string name) @safe pure nothrow { return cast(Signal)name; } I didn't know you could have an enum and extend it with a cast like this. Wow. This is not a good thing. Enums are supposed to denote a *closed*, enumerated set of items. It's fine here (but IMO bad style) because the author expects there to be user-created values casted to Signal passed to functions/templates that expect a Signal, but this would wreak havoc on code that was expecting a valid enum value (by valid, I mean only one of the predefined enum values).
Re: Daemonize v0.1 - simple way to create cross-platform daemons
On Sun, Aug 31, 2014 at 11:36 PM, Meta via Digitalmars-d-announce digitalmars-d-announce@puremagic.com wrote: I didn't know you could have an enum and extend it with a cast like this. This is not a good thing. Enums are supposed to denote a *closed*, enumerated set of items. I agree. It's fine here (but IMO bad style) because the author expects there to be user-created values casted to Signal passed to functions/templates that expect a Signal, but this would wreak havoc on code that was expecting a valid enum value (by valid, I mean only one of the predefined enum values). I was about to suggest final switch, until I saw this extension of Signal. I wonder what happens to final switch in this case.
Re: Daemonize v0.1 - simple way to create cross-platform daemons
I can (not must) have the form, the delegate params are tested independently from signal composition. OK, good. Is that the standard behavior for daemons in OSes? Most signals are simply ignored (except termination ones). I see. Some signals could be sent without any reason: sighup or interrogate in windows. Ignoring most signals is a better strategy, the exception could be done for terminating signals - their default handlers should set `shouldExit` flag to true. OK, I didn't know that. http://dlang.org/library/std/concurrency/receive.html Good idea, it will be implemented. Great!
Re: Looking to hire: 2-3 programmers, candidates will likely need to learn D.
On Saturday, 30 August 2014 at 09:52:51 UTC, Andrei Alexandrescu wrote: On 8/30/14, 2:35 AM, Jonathan M Davis wrote: On Friday, 29 August 2014 at 18:57:14 UTC, Andrei Alexandrescu wrote: On 8/29/14, 12:40 AM, Dejan Lekic wrote: Vic, I posted the job to the D Developer Network at LinkedIn: https://www.linkedin.com/groups/Looking-hire-2-3-programmers-3923820%2ES%2E5911023777222787073?trk=groups%2Finclude%2Fitem_snippet-0-b-ttl Dejan, could you please add yourself as an MVP responsible with the DDN on LinkedIn? http://wiki.dlang.org/People I also suggest we rename MVPs to Points of Contact. Didn't know about that page. Now, I kind of feel like I should put more about me on it. :| I think we need to have more than one pages dedicated to contributors, but my intent with Points of Contact is to have a short list of people responsible with specific topics. For example, for all matters related to dlang.org, the person responsible is... etc. How's it lookin' now?
Clojure transducers
Clojure is introducing a new way of composing functions (reducers this time), called transducers. It looks similar to composition/binding of functions, but somehow different. My functional-fu is not that deep to understand the statement transducers are as fundamental as function composition but it seems quite interesting. What is D's attitude toward this concept? Here is a blog I read about transducers today: http://thecomputersarewinning.com/post/Transducers-Are-Fundamental/
Re: Voting: std.logger
Am Sun, 31 Aug 2014 01:09:32 + schrieb Ola Fosheim Grøstad ola.fosheim.grostad+dl...@gmail.com: I've got some questions: How does logging interact with pure? You need to be able to log in pure functions. How do you come to that conclusion? Purity is a synonym for _not_ having side effects. That said - as usual - debug statements allow you to punch a hole into purity. […] Is logf() needed? Can't you somehow detect that the string is an immutable string literal with string formatting characters? 1) The first argument does not need to be a literal. 2) Checking the first argument for formatting chars slows the system down. 3) If you want to log a regular string, e.g. an incoming HTTP request or something that contains formatting symbols, log() would throw an exception about a missing second argument. This in turn could become a DOS vulnerability. Other than that, you could create an additional log function that only accepts compile-time known formatting strings as a CT argument and verifies the runtime argument types at the same time. -- Marco
Re: [OT] Microsoft filled patent applications for scoped and immutable types
On Sun, 31 Aug 2014 01:53:07 -0400 Nick Sabalausky via Digitalmars-d digitalmars-d@puremagic.com wrote: I know FSF prefers free over the open I've been using. But really, everybody knows what open and open source mean may i ask you: is DMD open and open source? and why the heck i can't fork it and redistribute, if it's open? everyone has it's own definition of what is open and what is free. signature.asc Description: PGP signature
Re: gdmd
On Sun, 31 Aug 2014 00:20:04 +0100 Iain Buclaw via Digitalmars-d digitalmars-d@puremagic.com wrote: That isn't the opposite. That's what gdmd does. Unless you mean translate gdc args to dmd. :) sorry, i must sleep more. ;-) sure, gdc-dmd conversion, to build my projects with dmd (i'm not using dub and too lazy to add compiler selection to my build system). here is rgdc, for example: http://repo.or.cz/w/rgdc.git it can be built w/o '-fwrite-pragma-libs=' support and it needs .rc file, but it works. ah, and it can't be built with current GDC, 'cause i'm using MonoTime which appears in 2.066. ;-) i ported it back to GDC, but never bother to publish patch, 'cause it will be obsoleted when GDC moves to 2.066 anyway. signature.asc Description: PGP signature
Re: Clojure transducers
What is D's attitude toward this concept? Hickey's original announcement is also interesting to read. Elegant, as always. It seems to me that ranges and range algorithms in D already permit this composition of actions, without the creation of intermediate structures: import std.algorithm; import std.functional: pipe; alias incsum = pipe!( map!(x = x+1), reduce!((x,y) = x+y) ); alias filtermap = pipe!( filter!(x = x%2==0), map!(x = x+1) ); alias mapfilter = pipe!( map!(x = x+1), filter!(x = x%2==0) ); void main() { auto sequence = iota(10); writeln(incsum(sequence)); // 55 writeln(filtermap(sequence)); // [1, 3, 5, 7, 9] writeln(mapfilter(sequence)); // [2, 4, 6, 8, 10] }
Re: [OT] Microsoft filled patent applications for scoped and immutable types
On Sunday, 31 August 2014 at 05:53:39 UTC, Nick Sabalausky wrote: Well, that page was an article written and posted by Stallman, not a TV sound bite. Would you really be able to sift though possibly a 10-100 page description that you can't properly decipher unless you were a lawyer? straightforward about things. And not pretend that GPL incompatible with GPL somehow isn't one hell of a gaping whole in that big 'ol GPL == Frdom assertion. The updated GPL handles cases that weren't come up with before the previous version was drafted. Like you mentioned with Tivoization. In a more general sense, I think Stallman/FSF have a very unfortunate habit of letting the strict goals and evangelism get in the way of the practical realities of actually *attaining* said goals and successfully getting the messages across. He is strict probably because taking any steps back could have horrible consequences. Sometimes you can't accept the lesser evil. I know FSF prefers free over the open I've been using. But really, everybody knows what open and open source mean, and it's *not* confusing and ambiguous. So the whole free obsession is just semantic pedantry that introduces ambiguity and confusion (free as in...what, which 'free' now? Because Linux...I mean GNU/Linux...is both types, right?) and distracts people from the more important matters. I always thought he was quite clear on what kind of 'free' he was talking about. But i guess more importantly is to see things from his view. Stallman was around when software was free and sources were open; There was no copyright in effect, and everyone helped with everything; You shared source and specs and programs and got your work done. Then NDA (Non-disclosure agreements) and closed source from corporations preventing you from being able to help everyone because they didn't want to share the source or specs on how to use it. (At the time it was XeroX printers i believe) which was a big warning of what was to come. He watched first hand as software and the computer industry went from thriving and open and growing, to closed and proprietary and secretive. His goal and wish is never to have it all so closed again that can't do anything besides sell your ethics or soul to get by day to day. On Sunday, 31 August 2014 at 06:19:24 UTC, ketmar via Digitalmars-d wrote: everyone has it's own definition of what is open and what is free. With lack of understanding, it's similar to comparing what is sweet when you have grapefruit coated with sugar vs an orange. Stallman has a strict criteria of what is 'free', but he refers to it as a programmer. You are free to run the program, to look at the source, to improve the source, to share the source... It has nothing to do with price/money. 'Open' can merely means you can see the source, nothing else. Really comes down to the license it's attached to.
Re: [OT] Microsoft filled patent applications for scoped and immutable types
On Sun, 31 Aug 2014 06:59:34 + Era Scarecrow via Digitalmars-d digitalmars-d@puremagic.com wrote: 'Open' can merely means you can see the source, nothing else. Really comes down to the license it's attached to. that's why i'm using the term Free and Open Source Software instead of Open Source Software (which ESR promotes). signature.asc Description: PGP signature
Re: [OT] EU patents [was Microsoft filled patent applications for scoped and immutable types]
Am Thu, 28 Aug 2014 11:08:29 +0100 schrieb Russel Winder via Digitalmars-d digitalmars-d@puremagic.com: Jérôme, On Thu, 2014-08-28 at 11:53 +0200, Jérôme M. Berger via Digitalmars-d wrote: […] PPS: IANAL but I have had lots of contacts with patent lawyers and I have taken part in several patent disputes as an expert witness. However, this was in France so most of my knowledge applies to French law and things may be different in the US. Are you tracking the new EU unitary patent and TTIP activity? We need to make sure the US does impose on the EU the same insane patent framework the US has. Haha :*). Don't worry, we EU citizens are more concerned about the issues of privacy, food regulations and corporate entities suing states for changing laws that cause them profit losses. A rubber stamping patent system without professionals investigating the claims has already been established years ago. All in all I am not too worried about TTIP anymore, seeing that the US reps didn't move in all the years of negotiations. With NGOs running against TTIP and an overall negative public stance I don't see it being bent over the knee. -- Marco signature.asc Description: PGP signature
Re: Voting: std.logger
On Tuesday, 29 July 2014 at 06:09:25 UTC, Andrei Alexandrescu wrote: 4. Replace defaultLogger with theLog. Logger is a word, but one that means lumberjack so it doesn't have the appropriate semantics. The use is generally acceptable as a nice play on words and as a disambiguator between the verb to log and the noun log. When we actually want to talk about the current log in an application, we should, however, call it the log. This is negotiable. FWIW: https://www.google.com/search?q=logger Here's the results I see: 8 results related to programming and log files 1 Wikipedia disambiguation page 1 sports-related result (La Crosse Loggers)
Re: [OT] Microsoft filled patent applications for scoped and immutable types
Am Thu, 28 Aug 2014 12:12:14 +0200 schrieb Daniel Kozak via Digitalmars-d digitalmars-d@puremagic.com: V Thu, 28 Aug 2014 11:53:35 +0200 Jérôme M. Berger via Digitalmars-d digitalmars-d@puremagic.com napsáno: I should have said that in D it is used when declaring an instance (i.e. at the place of the instance declaration) whereas in the patent it is used when declaring the type. For a patent lawyer, this will be enough to say that the patent is new. I don't agree completly // immutable is used when declaring the type IS immutable struct IS { string s; } IS s = IS(fff); s.s = d; writeln(s); ^ That I agree with! Prior art. -- Marco
Re: One Stop Shop?
On Saturday, 30 August 2014 at 19:19:48 UTC, Sativa wrote: I think it would be helpful to have the d lang site host tutorials/lessons on various aspects of D. D is hard to use for certain things like gui's, graphics(ogl, dx, etc), etc... not necessarily because D can't do these things but because the information is not out there. If The D site hosted, sort of like a wiki, but with properly designed articles about how to do things in D, maybe more people would start to use it? For example, I'd like to get into graphics and gui programming using D. I could use something like C#.NET which would make life easier but I don't like the drawbacks of C#. But trying to find coherent information, say, to draw an image on screen using opengl and D is nearly impossible... and way too time consuming, compared to finding similar information using C/C++ or most other popular languages. Getting D to work in these scenarios are already complicated enough. Usually it relies on the work of one person who hasn't made it clear how to do it well. I know D can do graphics, I've seen it done... I've even read some tutorials on it... but nothing is clear, relevant, or updated. Having a quick way to access stuff in the categories like Sound(playing sounds, VST design) Graphics(Gui, 2D/3D using open GL, etc...) etc... e.g., suppose I want to create a vst in D... google D lang vst, and the only relevant site that comes up is: http://le-son666.com/software/vstd/ Woo hoo! looks like someone did the work for us! But seriously? There is just enough information to hang myself. Do I really want to go down this path and potentially waste countless hours trying to get something to work that might not? I feel many others go through the same thought processes. If there was a wiki like site for D that is based on tutorials and experiences/results then surely it would help a lot of people. If people could contribute there problems or solutions in a unified and connected way, it would be easier to find the relevant information than it is now. About 95% of the time when I search for something that I want to do in D, I get a forum post... and about 15% of the time it actually leads to something useful. Maybe bout 5% of the time it actually solves my problem. There is just so much junk out there and all the gems are lost. Most of the gems need some polishing to show their true beauty. Sorry to say, but this is how a community-backed language works. D does not have a giant corporate sponsor like C#, who can pay for reams of documentation and tutorials. You're expected to like D enough to learn the language on your own (http://ddili.org/ders/d.en/index.html) and then either be able to pick up OpenGL on your own (http://open.gl/) or know it already and be able to apply D to the OpenGL API, which as a C-style API is pretty straightforward to call from D. Yes, it would be nice if D had a bunch of tutorials for all these things, but they don't usually exist right now because the community hasn't written them, for a variety of reasons including nobody is paying for it. It would be nice if O'Reilly or whoever started selling such tutorials, but maybe D isn't big enough yet for them to care. D is still in the early stages of adoption (http://en.wikipedia.org/wiki/Diffusion_of_innovations), and since you're not getting charged lots of money for the privilege, as you might to buy early cutting-edge hardware like Google Glass or Oculus Rift, it will cost you time instead. Sorry to say you'll just have to keep panning around for gems, as that's where D is at right now. Those of us who stick around think the time spent is worth it.
Re: Voting: std.logger
On Sunday, 31 August 2014 at 06:11:56 UTC, Marco Leise wrote: Am Sun, 31 Aug 2014 01:09:32 + schrieb Ola Fosheim Grøstad ola.fosheim.grostad+dl...@gmail.com: How does logging interact with pure? You need to be able to log in pure functions. How do you come to that conclusion? Purity is a synonym for _not_ having side effects. That said - as usual - debug statements allow you to punch a hole into purity. 1. ~90% of all functions are weakly pure, if you cannot log execution in those functions then logging becomes a liability. 2. If you define logging in a weakly pure function as tracing of execution rather than logging of state, then you can allow memoization too. 3. You don't normally read back the log in the same execution, state is thus not preserved through logging within a single execution. It has traits which makes it less problematic than general side effects that change regular global variables.
rdmd - No output when run on WebFaction
Hi all, On WebFaction, my Linux shared hosting server, I created a simple Hello, World! script in a file named hello.d. Attempting to run the script with rdmd hello.d yielded no error messages, and strangely, no output. However, the following works, and I see the output: (1) dmd hello.d (2) ./hello Running rdmd --chatty hellod.d shows D writing some files to /tmp folder and calling exec on the final temp file. I suspect the reason I'm not seeing any output using rdmd has something to do with WebFaction's security policies disallowing any execution on files in the /tmp folder. May I request that rdmd check, say, the environment variables tmp or temp for the path to write the temporary files in? Thanks!
Re: [OT] EU patents [was Microsoft filled patent applications for scoped and immutable types]
On Sun, 2014-08-31 at 09:35 +0200, Marco Leise via Digitalmars-d wrote: […] Haha :*). Don't worry, we EU citizens are more concerned about the issues of privacy, food regulations and corporate entities suing states for changing laws that cause them profit losses. This is certainly the major issue against TTIP as far as the UK Greens are concerned. Government passes law for voters good. Company doesn't like it because it ruins their income stream, sues government for loss of income. Due to TTIP, government loses. Tobacco companies are going to love this. A rubber stamping patent system without professionals investigating the claims has already been established years ago. The EU patent office yes, but not the UK one. The issue here is to stop the EU patent office becoming the only one. There is a very serious strategy issue here and it isn't a done deal thankfully. All in all I am not too worried about TTIP anymore, seeing that the US reps didn't move in all the years of negotiations. With NGOs running against TTIP and an overall negative public stance I don't see it being bent over the knee. TTIP and CETA are still very serious issues so people should continue to worry. Even if there is negative public opinion, the politicians will ram it through on the grounds they are the elected representatives, even though in reality they are doing it because their corporate paymasters of the future tell them to. In the UK the government are using the Scottish independence referendum as a smoke screen to avoid TTIP becoming news. This is a clear indicator it is bad for voters. -- Russel. = Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.win...@ekiga.net 41 Buckmaster Roadm: +44 7770 465 077 xmpp: rus...@winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder signature.asc Description: This is a digitally signed message part
Re: [OT] Microsoft filled patent applications for scoped and immutable types
On Sunday, 31 August 2014 at 04:25:11 UTC, Nick Sabalausky wrote: And I *do* appreciate that GPL, unlike BSD, can *realistically* be cross-licensed with a commercial license in a meaningful way and used on paid commercial software (at least, I *think* so, based on what little anyone actually *can* comprehend of the incomprehensible GPL). What? Did you mean to write BSD, unlike GPL? Explain what you mean. As for Stallman, his problem is that his all software must be free crusade happens to have a few real benefits from some source being open, but will never happen to his idealistic extreme of all source becoming free because closed source has real benefits too. That's why when linux finally got deployed to the majority of computing devices over the last 5 years- though still not on the desktop ;) - it wasn't a full GPL stack but a permissively-licensed Apache stack (bionic, dalvik, ART, etc) on top of the GPL'd linux kernel combined with significant closed binary blobs and patches. That mixed model is dominant these days, whether with iOS/OS X and their mix of open source (mach, darwin, llvm, webkit, etc) and closed or Android with its greater mix of open source. As such, his GPL, which doesn't allow such pragmatic mixing of open and closed source, is an antiquity and fast disappearing.
Re: [OT] Microsoft filled patent applications for scoped and immutable types
On 8/31/2014 2:59 AM, Era Scarecrow wrote: On Sunday, 31 August 2014 at 05:53:39 UTC, Nick Sabalausky wrote: Well, that page was an article written and posted by Stallman, not a TV sound bite. Would you really be able to sift though possibly a 10-100 page description that you can't properly decipher unless you were a lawyer? I have a hard time believing there's no middle ground there. Shoot, even theoretical physics has simplified explanations (A Brief History of Time). No doubt this could be summarized too without resorting to MS try be bad. GPLv3 stop MS be bad. Ug. straightforward about things. And not pretend that GPL incompatible with GPL somehow isn't one hell of a gaping whole in that big 'ol GPL == Frdom assertion. The updated GPL handles cases that weren't come up with before the previous version was drafted. Like you mentioned with Tivoization. Yea, I know there were reasons a new version needed to be created. But if a license designed with the specific and sole purpose of promoting openness can't even get along with another version itself, then something's clearly gone horribly, horribly wrong with it. I can link BSD 2-clause, 3-clause and even 4-clause all into the same program just fine. Forget the usual BSD vs GPL argument about GPL viral unwillingness to play nice with other licenses, the thing can't even play nice with *itself*! Know what I really want to see? I wanna see some smart-ass make a GPL program statically linking GPLv2 code with GPLv3 code. Then drift it past the FSF's nose. I'd be fascinated to see what happens. Does FSF conveniently drop the GPLv2 and GPLv3 are incompatible bullshit and just let it slide? Or do they lawyer-up in an idiotic brawl against their own creations? Or do their heads just spin around, let out a puff of smoke and explode? In a more general sense, I think Stallman/FSF have a very unfortunate habit of letting the strict goals and evangelism get in the way of the practical realities of actually *attaining* said goals and successfully getting the messages across. He is strict probably because taking any steps back could have horrible consequences. Sometimes you can't accept the lesser evil. So, through his stubbornness to accept the lesser as a stepping stone to his ultimate goal, he allows the larger evil to thrive instead. Brilliant strategy. Bravo. A real win for freedom. It's like a little kid kicking and screaming about not getting a 20lb crate of candy when he's already being offered a chocolate bar the size of his head. Or a third place runner who pouts and storms off because he didn't get the gold. Take what you *can* get, and *then* continue moving towards the real goal. All-or-nothing is self-defeat. Stallman was around when software was free and sources were open; There was no copyright in effect, and everyone helped with everything; You shared source and specs and programs and got your work done. Then NDA (Non-disclosure agreements) and closed source from corporations preventing you from being able to help everyone because they didn't want to share the source or specs on how to use it. (At the time it was XeroX printers i believe) which was a big warning of what was to come. He watched first hand as software and the computer industry went from thriving and open and growing, to closed and proprietary and secretive. His goal and wish is never to have it all so closed again that can't do anything besides sell your ethics or soul to get by day to day. Yea, that's a fascinating story. But honestly, I really am totally with him on all that. I *really* genuinely am, no BS. But reality doesn't give a crap how much he wants openness or what his background is: Things aren't going to go his way just because he wants it badly enough. He has attempt his goals within the framework of reality. Displace proprietary junk in favor of open? Hell yea, I'll take some of that. Absolutely. But without giving people what they want, even if what they want happens to include a little bit of *viiilll* closed stuff, then THEY'RE NOT FUCKING GONNA JUMP ON BOARD. It just NOT going to happen. It's been how many freaking decades and it *HASN'T* happened. Has he really not noticed, after all those years, that the puritanical all-or-nothing approach DOES NOT WORK? Shoot, pragmatic distros like Mint and Ubuntu have done FAR more to get people onboard with, and embracing, and pushing for more open software than ANY purity distro. This is plainly evident. He can't *not* see it. It's basic marketing: Offer them what they want. Give them a taste. They might want more. But *don't* offer what they want, and you seriously think you'll get takers? Fat chance. I'm not sure Stallman really gets this. Or if he does, then he's too stubborn about it for his own good. (And believe me, I know a thing or two about being stubborn ;)) Luckily, he has followers who *do* grasp basic
Re: Voting: std.logger
Am Sun, 31 Aug 2014 08:52:58 + schrieb Ola Fosheim Grøstad ola.fosheim.grostad+dl...@gmail.com: On Sunday, 31 August 2014 at 06:11:56 UTC, Marco Leise wrote: Am Sun, 31 Aug 2014 01:09:32 + schrieb Ola Fosheim Grøstad ola.fosheim.grostad+dl...@gmail.com: How does logging interact with pure? You need to be able to log in pure functions. How do you come to that conclusion? Purity is a synonym for _not_ having side effects. That said - as usual - debug statements allow you to punch a hole into purity. 1. ~90% of all functions are weakly pure, if you cannot log execution in those functions then logging becomes a liability. 2. If you define logging in a weakly pure function as tracing of execution rather than logging of state, then you can allow memoization too. Ok, here is the current state: Logging is not a first-class language feature with special semantics. Drop your pure keywords on those 90% of functions or only log in debug. 3. You don't normally read back the log in the same execution, state is thus not preserved through logging within a single execution. It has traits which makes it less problematic than general side effects that change regular global variables. I still don't see it fly even theoretically. The stdlog will be an interface with an arbitrary implementation behind it. A file logger will eventually hit a disk full state and throw an exception. Since pure implies that a function call can be elided such a change of execution path cannot work. It is much like discussing the strictness of transitive const. If you need to cache values of initialize on first access, you just have to drop const. -- Marco
Re: [OT] Microsoft filled patent applications for scoped and immutable types
On Sun, 31 Aug 2014 09:23:24 + Joakim via Digitalmars-d digitalmars-d@puremagic.com wrote: As such, his GPL, which doesn't allow such pragmatic mixing of open and closed source, is ...a great thing to stop invasion of proprietary software. hey, i'm not *renting* my smartphone, i'm *buying* it! and i want to be able to change it's software as i like. yet what i got is a bunch of blobs and a locked loader. i don't want to pay my money for jailing me: the ones who want to put me in a jail should pay to me to compensate my inconvience. i don't care about what is good for some corporation out here. what i really care about is what is good for *me*. GPLv3 makes me happy. BSDL makes corporations happy. so it's obvious choice. signature.asc Description: PGP signature
Re: Voting: std.logger
On Sunday, 31 August 2014 at 09:34:51 UTC, Marco Leise wrote: Am Sun, 31 Aug 2014 08:52:58 + schrieb Ola Fosheim Grøstad ola.fosheim.grostad+dl...@gmail.com: On Sunday, 31 August 2014 at 06:11:56 UTC, Marco Leise wrote: Am Sun, 31 Aug 2014 01:09:32 + schrieb Ola Fosheim Grøstad ola.fosheim.grostad+dl...@gmail.com: I still don't see it fly even theoretically. The stdlog will be an interface with an arbitrary implementation behind it. A file logger will eventually hit a disk full state and throw an exception. Why would that be the sole outcome? There are several strategies to cope with that, maybe through a special logger. For example: - start writing over the old logs transparently (because, usually, the most important logs are the most recent ones) - simply fake logging, but not logging anything more (keeping all history and simply discard anything that comes after the disk is full) These could be solved easily, by catching the exception and either processing it (the first strategy), either by ignoring it (the second strategy). But it matters to have the functionality by default.
Re: rdmd - No output when run on WebFaction
Am Sun, 31 Aug 2014 09:01:23 + schrieb David Chin dlc...@me.com: Hi all, On WebFaction, my Linux shared hosting server, I created a simple Hello, World! script in a file named hello.d. Attempting to run the script with rdmd hello.d yielded no error messages, and strangely, no output. However, the following works, and I see the output: (1) dmd hello.d (2) ./hello Running rdmd --chatty hellod.d shows D writing some files to /tmp folder and calling exec on the final temp file. I suspect the reason I'm not seeing any output using rdmd has something to do with WebFaction's security policies disallowing any execution on files in the /tmp folder. May I request that rdmd check, say, the environment variables tmp or temp for the path to write the temporary files in? Thanks! Sorry for hijacking. I believe any program should remove what it placed in /tmp on exit and actively manage any cached files under /var/lib, e.g. by age or size of the cache. In the case of rdmd, I'd even prefer to just do what most native compilers do and place object files alongside the sources, but allow custom object file directories. Usually I wouldn't say anything, because endless bike-shedding ensues, but it looks like now there is a technical argument, too. :p -- Marco
Re: Voting: std.logger
On Sunday, 31 August 2014 at 09:34:51 UTC, Marco Leise wrote: Ok, here is the current state: Logging is not a first-class language feature with special semantics. Drop your pure keywords on those 90% of functions or only log in debug. Then maybe the language lacks features that allow you to escape purity in a safe manner. But maybe you should only allow trace() and not log() in pure functions. Tracing execution and logging state. I still don't see it fly even theoretically. The stdlog will be an interface with an arbitrary implementation behind it. An interface can require specific properties of the implementation. file logger will eventually hit a disk full state and throw an exception. Since pure implies that a function call can be elided such a change of execution path cannot work. Not sure what you mean by this. The logger I am most interested in writes to a circular buffer and uploads the log to a database on a crash so that the source of the crash can be identified. I am only interested in in logging execution, not preserved state without execution. It is not uncommon to have loggers that writes to a fixed size preallocated area that behaves like a circular buffer (e.g. retain at most 1GB and 3 months old logging-data)
Re: rdmd - No output when run on WebFaction
On Sunday, 31 August 2014 at 09:51:13 UTC, Marco Leise wrote: Am Sun, 31 Aug 2014 09:01:23 + schrieb David Chin dlc...@me.com: Hi all, On WebFaction, my Linux shared hosting server, I created a simple Hello, World! script in a file named hello.d. Attempting to run the script with rdmd hello.d yielded no error messages, and strangely, no output. However, the following works, and I see the output: (1) dmd hello.d (2) ./hello Running rdmd --chatty hellod.d shows D writing some files to /tmp folder and calling exec on the final temp file. I suspect the reason I'm not seeing any output using rdmd has something to do with WebFaction's security policies disallowing any execution on files in the /tmp folder. May I request that rdmd check, say, the environment variables tmp or temp for the path to write the temporary files in? Thanks! Sorry for hijacking. I believe any program should remove what it placed in /tmp on exit and actively manage any cached files under /var/lib, e.g. by age or size of the cache. In the case of rdmd, I'd even prefer to just do what most native compilers do and place object files alongside the sources, but allow custom object file directories. Usually I wouldn't say anything, because endless bike-shedding ensues, but it looks like now there is a technical argument, too. :p There are some other technical arguments, too, but it looks like they speak against /var/lib: * Permissions: /var/lib is not world-writable; there would either need to be a new world-writable directory below it (bad practice), or rdmd would have to run as setuid with a dedicated user. That's not a good idea either, because users would then have access to other users' binaries. * Similarly, you don't want to store the binaries next to the sources if those are in /usr/bin, for example. * /tmp is often cleaned regularly. But maybe /var/tmp would be more appropriate than /tmp. About the original post: While the cause of the problem seems clear in your case, rdmd also doesn't print anything when the compiled program segfaults. This could be another candidate for the observed behaviour.
Re: One Stop Shop?
On Sunday, 31 August 2014 at 08:44:39 UTC, Joakim wrote: Sorry to say, but this is how a community-backed language works. D does not have a giant corporate sponsor like C#, who can pay for reams of documentation and tutorials. You're expected to like D enough to learn the language on your own (http://ddili.org/ders/d.en/index.html) and then either be able to pick up OpenGL on your own (http://open.gl/) or know it already and be able to apply D to the OpenGL API, which as a C-style API is pretty straightforward to call from D. Yes, it would be nice if D had a bunch of tutorials for all these things, but they don't usually exist right now because the community hasn't written them, for a variety of reasons including nobody is paying for it. It would be nice if O'Reilly or whoever started selling such tutorials, but maybe D isn't big enough yet for them to care. D is still in the early stages of adoption (http://en.wikipedia.org/wiki/Diffusion_of_innovations), and since you're not getting charged lots of money for the privilege, as you might to buy early cutting-edge hardware like Google Glass or Oculus Rift, it will cost you time instead. Sorry to say you'll just have to keep panning around for gems, as that's where D is at right now. Those of us who stick around think the time spent is worth it. It's not that bad, though. For one, http://code.dlang.org/ has established itself as _the_ central hub for D libraries. Then, there is a redesign of the website underway (albeit slowly), which hopefully will greatly improve visibility of the documentation, tutorials, and of course, should have a link to code.dlang.org in a prominent place. And last but not least, the Wiki has lots of tutorials, though again it's IMO not discoverable enough: http://wiki.dlang.org/Articles http://wiki.dlang.org/Tutorials
Re: [OT] Microsoft filled patent applications for scoped and immutable types
On Sunday, 31 August 2014 at 09:37:35 UTC, ketmar via Digitalmars-d wrote: On Sun, 31 Aug 2014 09:23:24 + Joakim via Digitalmars-d digitalmars-d@puremagic.com wrote: As such, his GPL, which doesn't allow such pragmatic mixing of open and closed source, is ...a great thing to stop invasion of proprietary software. hey, i'm not *renting* my smartphone, i'm *buying* it! and i want to be able to change it's software as i like. yet what i got is a bunch of blobs and a locked loader. i don't want to pay my money for jailing me: the ones who want to put me in a jail should pay to me to compensate my inconvience. i don't care about what is good for some corporation out here. what i really care about is what is good for *me*. GPLv3 makes me happy. BSDL makes corporations happy. so it's obvious choice. Good luck with that, let me know when you find a GPLv3 smartphone to buy. I'll predict when that'll happen: never. That's because _you_ may care about changing the software on your smartphone and don't want to use the binary blobs that make switching harder, but almost nobody else does. Those who want to change the software right now simply work around and reuse the blobs, ie cyanogen, AOKP, etc. At least you can do that when there's a mix, as opposed to the previously dominant model of pure closed source, which didn't allow such updating at all.
Re: [OT] Microsoft filled patent applications for scoped and immutable types
On Sun, 31 Aug 2014 10:23:42 + Joakim via Digitalmars-d digitalmars-d@puremagic.com wrote: Good luck with that, let me know when you find a GPLv3 smartphone to buy. I'll predict when that'll happen: never. keep tolerate permissive licenses, this will greatly help me to find such smartphone, yes. signature.asc Description: PGP signature
Re: [OT] Microsoft filled patent applications for scoped and immutable types
On 8/31/2014 5:23 AM, Joakim wrote: On Sunday, 31 August 2014 at 04:25:11 UTC, Nick Sabalausky wrote: And I *do* appreciate that GPL, unlike BSD, can *realistically* be cross-licensed with a commercial license in a meaningful way and used on paid commercial software (at least, I *think* so, based on what little anyone actually *can* comprehend of the incomprehensible GPL). What? Did you mean to write BSD, unlike GPL? Explain what you mean. There is some precedent for a commercial software package to be released like this: This is available under either a commercial license or GPL. You can freely download and use the software and its source code, at no cost, under the terms of the GPL. Companies that do not wish to be bound by the GPL can purchase a commercial license instead. Or there will be a common variant like: Students, home users and small businesses can use it under the terms of GPL, but companies with annual revenue = $x require a commercial license. Or something roughly along those lines anyway. I don't know what the FSF would have to say about it, or how well it works in practice, but the idea is that the source code is both free and free, AND since the OSS license used is GPL, there is still (at least in theory) sufficient added value to to justify a paid version (beyond just premium support. Being a support-based business has its own pros/cons - if you're just a group of developers trying to make a living, the Red Hat model may not be a great option). And, the OSS-version, being GPLed, cannot easily be used by another company *as* a competitor to you. Theoretically, you *could* do that with BSD/MIT/zlib/etc instead of GPL. Nothing's explicitly prohibiting it. But then where's the added value in the paid version? They can already do anything they want. Or how do you restrict the OSS version to small businesses or home users only? It's BSD, it already permits *anyone* to use it or re-grant the same permissive license to anyone else. And what's to stop a competitor from competing against you with your own product? Don't get me wrong, I like BSD/MIT/zlib/etc., and I use such licenses whenever my intent is to get my software USED rather than directly make money off it. But trying to mix them with a commercial model (for example, if you want to make a living directly off your software) seems very problematic. Being a support company seems the only theoretical way, and even then, anyone else, any corporation, etc., can still just pop up and offer support for your software too, and without the overhead of being a primary developer. As for Stallman, his problem is that his all software must be free crusade happens to have a few real benefits from some source being open, but will never happen to his idealistic extreme of all source becoming free because closed source has real benefits too. Yea, I can agree there's some truth to that. And even if you can argue that closed doesn't TRULY have real genuine benefits, it still doesn't matter: As long as people perceive a benefit, then that's real enough in its effects. That's why when linux finally got deployed to the majority of computing devices over the last 5 years- though still not on the desktop ;) - it wasn't a full GPL stack but a permissively-licensed Apache stack (bionic, dalvik, ART, etc) on top of the GPL'd linux kernel combined with significant closed binary blobs and patches. That mixed model is dominant these days, whether with iOS/OS X and their mix of open source (mach, darwin, llvm, webkit, etc) and closed or Android with its greater mix of open source. As such, his GPL, which doesn't allow such pragmatic mixing of open and closed source, is an antiquity and fast disappearing. Yea. I hate that the mixing is necessary, but big business has all the money, and big business likes closed/proprietary, so if you want some of the money (*or* just a significant chunk of the market), then you have to please them enough to get them to fork it over. *Then* you can go from there and swing around as much clout as you've earned. It's sickening, but that's where things are right now. At least it beats the hell out of the Windows model. And it *could* still lead to further acceptance of and demand for even more openness. Like burgers or crack: Give 'em a taste, maybe they'll like it and want more. And maybe by then you'll have earned enough clout that you'll be *able* to given them more. The world may not be ready for full-on Stallman openness yet, but the mixed model at least gets the foot in the door. It's a step in the right direction.
Re: [OT] Microsoft filled patent applications for scoped and immutable types
On Sunday, 31 August 2014 at 09:23:28 UTC, Nick Sabalausky wrote: I have a hard time believing there's no middle ground there. Shoot, even theoretical physics has simplified explanations (A Brief History of Time). No doubt this could be summarized too without resorting to MS try be bad. GPLv3 stop MS be bad. Ug. It's all based on the legal system and if it is taken to court, so that's where it's at. I'd love to say there's no middle ground, but i honestly don't know. Could ask him for exact details. But if a license designed with the specific and sole purpose of promoting openness can't even get along with another version itself, then something's clearly gone horribly, horribly wrong with it. I've glanced over sources and put in my own for License GPLv2 or later. Each progressive version adds more protection. It's probably only incompatible so someone can't take a GPLv3 of a program and slap a GPLv2 on it 'cause it's compatible' then use the lesser protection to get around it for which the v3 was specifically giving. Beyond that both licenses work to grant and protect the author as much as possible. I can link BSD 2-clause, 3-clause and even 4-clause all into the same program just fine. Forget the usual BSD vs GPL argument about GPL viral unwillingness to play nice with other licenses, the thing can't even play nice with *itself*! The viral nature is to ensure programs and software grows (hopefully) and stays to it's original intent. A sed program suddenly no longer being free or changing owners would be scooped up by a greedy company in a heartbeat, especially if it's heavily used. Know what I really want to see? I wanna see some smart-ass make a GPL program statically linking GPLv2 code with GPLv3 code. Then drift it past the FSF's nose. I'd be fascinated to see what happens. Does FSF conveniently drop the GPLv2 and GPLv3 are incompatible bullshit and just let it slide? Or do they lawyer-up in an idiotic brawl against their own creations? Or do their heads just spin around, let out a puff of smoke and explode? As for GPLv2 and GPLv3 code, depends on the license in the sourcecode. As mentioned the GPLv2 code could automatically be upgraded as it would offer no disadvantages, especially if the source says you can use v2 or later... no problems. Course if some software does have to link there's always the LGPL for libraries and whatnot... But reality doesn't give a crap how much he wants openness or what his background is: Things aren't going to go his way just because he wants it badly enough. He has attempt his goals within the framework of reality. snip The ones to control who or what works is the people who vote with their wallets. If no one buys proprietary software, then it won't work. Unfortunately even if no citizens bought it, businesses still do. It's entirely possible things will go his way, and i surely hope so since the vision is a very good one. However i don't feel up to a really long rant or discussion on this, this isn't why i brought this all up. We can bang the dictionary all we want, but really, aside from the ultra-pedantics, nobody actually means that narrow definition when they say open source. Perhaps not. But quite often you can only take it 'to the letter'. And the lawyers love to take it 'to the letter'; Along with companies that own the 'open source' that is spoken about.
Re: One Stop Shop?
On Sunday, 31 August 2014 at 10:14:05 UTC, Marc Schütz wrote: And last but not least, the Wiki has lots of tutorials, though again it's IMO not discoverable enough: http://wiki.dlang.org/Articles http://wiki.dlang.org/Tutorials You're moving the goal posts. He specifically asked about D tutorials for playing sounds, VST design, Gui, 2D/3D using open GL. I don't see anything like that in your links. D programmers are expected to learn D through your links and then apply it towards those topics on their own, whereas other languages provide even more instruction to beginners who want to use D for those subjects, which is what he's asking for. D is not at the stage to provide that yet.
Re: gdmd
On 30/08/14 21:34, Russel Winder via Digitalmars-d wrote: On Sat, 2014-08-30 at 20:48 +0300, ketmar via Digitalmars-d wrote: […] maybe i should write gdmd too, just for completeness sake. ;-) Two alternatives I think: 1. Rewrite it in something other than Perl, D or Python mayhap. 2. Let it pass away into history. FWIW I've continued using the perl script with no apparent problems. Though my dmd-esque flags don't get very adventurous, so perhaps I'm just not bumping into problems that might exist ;-)
Re: [OT] Microsoft filled patent applications for scoped and immutable types
On 8/31/2014 5:37 AM, ketmar via Digitalmars-d wrote: On Sun, 31 Aug 2014 09:23:24 + Joakim via Digitalmars-d digitalmars-d@puremagic.com wrote: As such, his GPL, which doesn't allow such pragmatic mixing of open and closed source, is ...a great thing to stop invasion of proprietary software. hey, i'm not *renting* my smartphone, i'm *buying* it! and i want to be able to change it's software as i like. yet what i got is a bunch of blobs and a locked loader. i don't want to pay my money for jailing me: the ones who want to put me in a jail should pay to me to compensate my inconvience. I *completely* agree. Very, VERY strongly. i don't care about what is good for some corporation out here. what i really care about is what is good for *me*. GPLv3 makes me happy. GPL forces companies to open-source (some of) their software...but *ONLY* if the company willingly uses the GPL software in the first place. So what do they do? Not use the GPL software in the first place. So we end up with second-rate crap (like Bionic) or worse - closed source proprietary - just because GPL scared them away. BSDL makes corporations happy. so it's obvious choice. Hah. BSD/etc is NOT what corporations typically like - they like proprietary closed source. BSD gives them incentive to at least *use* OSS software. GPL gives them incentive to stay away from OSS software.
Re: [OT] Microsoft filled patent applications for scoped and immutable types
On Sun, 31 Aug 2014 06:46:15 -0400 Nick Sabalausky via Digitalmars-d digitalmars-d@puremagic.com wrote: So what do they do? Not use the GPL software in the first place. So we end up with second-rate crap (like Bionic) or worse - closed source proprietary - just because GPL scared them away. this will not change. it's not specifically GPL what scares away corporations, it's about losing control. corporations will always be hostile to any license that tries to give end users some rights that can be enforced by user. releasing software under permissive licenses will not help to turn corporations to FOSS. so i can't see any reason to think about how we can drag corporations into FOSS culture. Hah. BSD/etc is NOT what corporations typically like - they like proprietary closed source. BSD gives them incentive to at least *use* OSS software. GPL gives them incentive to stay away from OSS software. i don't care what source code was used to build binary blob: proprietary or BSD-licensed. the result is the same for me. so i don't care if they use [F]OSS software or not. signature.asc Description: PGP signature
Re: One Stop Shop?
On Saturday, 30 August 2014 at 19:19:48 UTC, Sativa wrote: I think it would be helpful to have the d lang site host tutorials/lessons on various aspects of D. D is hard to use for certain things like gui's, graphics(ogl, dx, etc), etc... not necessarily because D can't do these things but because the information is not out there. If The D site hosted, sort of like a wiki, but with properly designed articles about how to do things in D, maybe more people would start to use it? For example, I'd like to get into graphics and gui programming using D. I could use something like C#.NET which would make life easier but I don't like the drawbacks of C#. But trying to find coherent information, say, to draw an image on screen using opengl and D is nearly impossible... and way too time consuming, compared to finding similar information using C/C++ or most other popular languages. Getting D to work in these scenarios are already complicated enough. Usually it relies on the work of one person who hasn't made it clear how to do it well. I know D can do graphics, I've seen it done... I've even read some tutorials on it... but nothing is clear, relevant, or updated. Having a quick way to access stuff in the categories like Sound(playing sounds, VST design) Graphics(Gui, 2D/3D using open GL, etc...) etc... e.g., suppose I want to create a vst in D... google D lang vst, and the only relevant site that comes up is: http://le-son666.com/software/vstd/ Woo hoo! looks like someone did the work for us! But seriously? There is just enough information to hang myself. Do I really want to go down this path and potentially waste countless hours trying to get something to work that might not? I feel many others go through the same thought processes. If there was a wiki like site for D that is based on tutorials and experiences/results then surely it would help a lot of people. If people could contribute there problems or solutions in a unified and connected way, it would be easier to find the relevant information than it is now. About 95% of the time when I search for something that I want to do in D, I get a forum post... and about 15% of the time it actually leads to something useful. Maybe bout 5% of the time it actually solves my problem. There is just so much junk out there and all the gems are lost. Most of the gems need some polishing to show their true beauty. Professional tutorials would, of course, be ideal. Unfortunately they take a lot of time and effort to write. There is a middle ground between an API such as the link you've given and writing full-blown tutorials. It's relatively easy to write up a set of examples covering the most common cases. First a Hello World example to get started and then a dozen more involved examples. They could be posted on the wiki or put in a Git repo and then linked from the wiki.
Re: One Stop Shop?
On Sunday, 31 August 2014 at 10:36:52 UTC, Joakim wrote: On Sunday, 31 August 2014 at 10:14:05 UTC, Marc Schütz wrote: And last but not least, the Wiki has lots of tutorials, though again it's IMO not discoverable enough: http://wiki.dlang.org/Articles http://wiki.dlang.org/Tutorials You're moving the goal posts. He specifically asked about D tutorials for playing sounds, VST design, Gui, 2D/3D using open GL. I don't see anything like that in your links. D programmers are expected to learn D through your links and then apply it towards those topics on their own, whereas other languages provide even more instruction to beginners who want to use D for those subjects, which is what he's asking for. D is not at the stage to provide that yet. That's true, but your reply sounds overly pessimistic: this is how a community-backed language works, you'll just have to keep panning around for gems. I wanted to point out that there is some work underway to improve the situation.
Re: [OT] Microsoft filled patent applications for scoped and immutable types
On Sunday, 31 August 2014 at 10:30:24 UTC, Nick Sabalausky wrote: There is some precedent for a commercial software package to be released like this: This is available under either a commercial license or GPL. You can freely download and use the software and its source code, at no cost, under the terms of the GPL. Companies that do not wish to be bound by the GPL can purchase a commercial license instead. Ah, I wasn't sure what you meant by cross-licensed, the GPL/commercial licensing model you're referring to is commonly called dual-licensing. Or there will be a common variant like: Students, home users and small businesses can use it under the terms of GPL, but companies with annual revenue = $x require a commercial license. Or something roughly along those lines anyway. Under the terms of the GPL, it's not feasible to set an arbitrary revenue limit like that, as those getting the source under the GPL are free to redistribute it to anyone they like. However, since the GPLv2 doesn't deal with software patents, it may be possible to set such a revenue limit with patent licensing, ie license the software patents employed in the code for free to those you mentioned but charge for the patents with larger businesses. I don't know what the FSF would have to say about it, or how well it works in practice, but the idea is that the source code is both free and free, AND since the OSS license used is GPL, there is still (at least in theory) sufficient added value to to justify a paid version (beyond just premium support. Being a support-based business has its own pros/cons - if you're just a group of developers trying to make a living, the Red Hat model may not be a great option). And, the OSS-version, being GPLed, cannot easily be used by another company *as* a competitor to you. This dual-licensing model works fairly well, as a handful of companies have used it successfully and MySQL AB brought in almost 9 figures in revenue using this model before getting bought out by Sun for $1 billion almost seven years ago (http://en.wikipedia.org/wiki/MySQL_AB), although most think that was a big overpay by the soon-to-be-sold Sun. The MySQL CEO went on to head another company called Eucalyptus, which uses a similar GPLv3/commercial dual-licensing model. The big drawbacks are that dual licensing requires full copyright assignment from anyone who contributes to the GPL'd code, or the company won't be able to re-license those patches commercially, and that usually only one company can make money off the code through commercial licensing, which as you mentioned keeps competitors out. Theoretically, you *could* do that with BSD/MIT/zlib/etc instead of GPL. Nothing's explicitly prohibiting it. But then where's the added value in the paid version? They can already do anything they want. Or how do you restrict the OSS version to small businesses or home users only? It's BSD, it already permits *anyone* to use it or re-grant the same permissive license to anyone else. And what's to stop a competitor from competing against you with your own product? The dual-licensing model doesn't make sense with permissive licenses like BSD/MIT/zlib/boost so they use a different model, where they provide an open core of BSD-licensed code for free and then charge for proprietary features added through closed-source patches, sometimes called freemium. This is the model Apple and Google/Samsung use with iOS and Android, only the most successful software projects of the last decade, :) though Android obviously makes available a lot more open source than iOS does. This mixed model doesn't stop competitors from taking the permissively-licensed source, but that's actually a benefit for users as it means more competition. For example, you can see this with all the companies that forked Android, whether Amazon, Nokia, or Xiaomi, which now sells more smartphones in China than anyone else, including Samsung. As long as the companies provide enough value in their closed patches, they do fine. Don't get me wrong, I like BSD/MIT/zlib/etc., and I use such licenses whenever my intent is to get my software USED rather than directly make money off it. But trying to mix them with a commercial model (for example, if you want to make a living directly off your software) seems very problematic. Being a support company seems the only theoretical way, and even then, anyone else, any corporation, etc., can still just pop up and offer support for your software too, and without the overhead of being a primary developer. On the contrary, the mixed model that such permissive licenses allow is much more commercially successful than any GPL-based model. If you insist that _all_ source must be open, only then the GPL dual-licensing model may work better. Yea, I can agree there's some truth to that. And even if you can argue that closed doesn't TRULY have real genuine
Encapsulating trust
Quite recently a lot of work has been done to make most of Phobos usable in @safe code. While a very welcome effort, it caused a number of doubts in particular due to the boilerplate required to isolate a small amount of unsafe operations and slap @trusted over it. See e.g. Denis argument: https://github.com/D-Programming-Language/phobos/pull/2465 There were proposals for language changes along the lines of having @trusted block alike to debug/version blocks, but nothing ever came out of them. Without language support I decided it worth a shot to create a universal wrappers to establish a consistent convention. A use of such wrapper should indicate that a @system function call or language feature was hand-verified. Names and complete set of primitives are up for debate, but here is the start: https://gist.github.com/DmitryOlshansky/bc02f369c8a63818bd07 A bit of usage: import core.stdc.string; import trusted; void main() @safe { char[] msg = Hello!.dup; char[] msg2 = msg; import trusted; // may also use static import for absolute clarity assert(call!memcmp(addrOf(msg[0]), addrOf(msg2[0]), msg.length) == 0); } What do you guys think? -- Dmitry Olshansky
Re: code cleanup in druntime and phobos
On 30 August 2014 16:27, Joseph Rushton Wakeling via Digitalmars-d digitalmars-d@puremagic.com wrote: On 30/08/14 16:38, Daniel Murphy via Digitalmars-d wrote: It's a shame that your dislike of github is stronger than your desire to contribute code. I'm sorry, that won't wash. It's a given, especially now, that for some people, using these large-scale online social networks is a no-no. Many of us may view the practical benefits as outweighing those factors, but it's not acceptable to be dismissive or arrogant in the face of those concerns. Agreed. I had some reluctance to join github to begin with, but eventually conceded as being on github may help exposure and encourage people to contribute. In all honesty though, I can't say that there has really been any increase in external contribution vs bitbucket/sourceforge, so whatever benefits dmd or ldc got did not seem to carry over to gdc. The only change I have noticed as being part of github is a steady stream of monthly emails and phone calls (voice messages, I never answer them), be it universities conducting a study, or recruiters looking to interview me because they came across my profile. Sometimes its annoying, but reluctantly accepted as one of the perks of being on a social site. Iain.
Re: One Stop Shop?
On Saturday, 30 August 2014 at 19:19:48 UTC, Sativa wrote: I think it would be helpful to have the d lang site host tutorials/lessons on various aspects of D. D is hard to use for certain things like gui's, graphics(ogl, dx, etc), etc... not necessarily because D can't do these things but because the information is not out there. Youre right about alot of things and nobody here can disagree. Although the situation is different from what you would expect. D is a community backed language so everything is done by the community for the community, even documentation. Tutorials and stuff like that are extremely difficult to find because not everyone has had experience. I myself am trying to understand how to use GFM for graphics and stuff using SDL. Actually, if you want to do some graphics and stuff, look at the gfm code package. http://code.dlang.org/packages/gfm;. Make sure to download and install the SDL library - https://www.libsdl.org/download-2.0.php;. Then add these dependencies to your dub.json file. Everything will just download, compile and work right out of the box. gfm:core: =0.0.0, gfm:math: =0.0.0, gfm:image: =0.0.0, gfm:sdl2: =0.0.0 https://github.com/d-gamedev-team/gfm/blob/master/sdl2/gfm/sdl2/window.d; This is the crappiest part about D, you have to look through peoples source code and try to understand how to use it. Its terrible i know, but its the only way...
Re: DIP(?) Warning to facilitate porting to other archs
Am Fri, 02 May 2014 01:56:49 + schrieb bearophile bearophileh...@lycos.com: Temtaime: I think it's need to have -w64(or other name, offers ?) flag that warns if code may not compile on other archs. It's a problem and I'd like some way to compiler help solving such problems. I suggested this, that was refused (I don't remember who reopened it): https://issues.dlang.org/show_bug.cgi?id=5063 Bye, bearophile That would have be me going renegade against a RESOLVED-WONTFIX after I found a library that wouldn't compile on my amd64 because it mixed size_t and uint as if it was the same. Later I found a little flood of bug reports for other libraries as well. Whether a warning or size_t as a distinct type like some other language does, the current situation is the source of statically checkable, avoidable portability bugs. -- Marco
Re: code cleanup in druntime and phobos
On Sunday, 31 August 2014 at 15:33:45 UTC, Iain Buclaw via Digitalmars-d wrote: The only change I have noticed as being part of github is a steady stream of monthly emails and phone calls (voice messages, I never answer them), be it universities conducting a study, or recruiters looking to interview me because they came across my profile. Sometimes its annoying, but reluctantly accepted as one of the perks of being on a social site. Iain. I've never gotten calls (I didn't give my number). I have been asked to participate in 1 or 2 studies though. I've also been contacted by a recruiter, but it got me an awesome sweet new job, so that's a perk, arguably. I was also later contacted by another recruiter for the same company. So that was kind of ego boosting.
Re: [OT] Microsoft filled patent applications for scoped and immutable types
On 8/31/2014 7:57 AM, Joakim wrote: On Sunday, 31 August 2014 at 10:30:24 UTC, Nick Sabalausky wrote: There is some precedent for a commercial software package to be released like this: This is available under either a commercial license or GPL. You can freely download and use the software and its source code, at no cost, under the terms of the GPL. Companies that do not wish to be bound by the GPL can purchase a commercial license instead. Ah, I wasn't sure what you meant by cross-licensed, the GPL/commercial licensing model you're referring to is commonly called dual-licensing. Ah, ok. My mind registered cross- and dual- as being the same. Or there will be a common variant like: Students, home users and small businesses can use it under the terms of GPL, but companies with annual revenue = $x require a commercial license. Or something roughly along those lines anyway. Under the terms of the GPL, it's not feasible to set an arbitrary revenue limit like that, as those getting the source under the GPL are free to redistribute it to anyone they like. However, since the GPLv2 doesn't deal with software patents, it may be possible to set such a revenue limit with patent licensing, ie license the software patents employed in the code for free to those you mentioned but charge for the patents with larger businesses. Come to think of it, the size/revenue-limit stuff I've seen may have all just been plain old closed-source. The big drawbacks are that dual licensing requires full copyright assignment from anyone who contributes to the GPL'd code, or the company won't be able to re-license those patches commercially, Good point. I wasn't aware of that. (One of the dangers of GPL: It's too big and convoluted to really grok.) The dual-licensing model doesn't make sense with permissive licenses like BSD/MIT/zlib/boost so they use a different model, where they provide an open core of BSD-licensed code for free and then charge for proprietary features added through closed-source patches, Ahh, ok. Now that makes sense. That method hadn't occurred to me. (I don't know *why* it didn't. I mean, using the temporarily closed source you mention below, it's basically the id/Carmack model.) I don't like that it's still requires a closed element, but still, it's definitely something worth considering, especially the time limit version. sometimes called freemium. I'm accustomed to freemium referring to so-called free to play gaming, but yea, I can see how it applies here too. This is the model Apple and Google/Samsung use with iOS and Android, only the most successful software projects of the last decade, :) though Android obviously makes available a lot more open source than iOS does. Yea, true. Yea. I hate that the mixing is necessary, but big business has all the money, and big business likes closed/proprietary, so if you want some of the money (*or* just a significant chunk of the market), then you have to please them enough to get them to fork it over. *Then* you can go from there and swing around as much clout as you've earned. It's sickening, but that's where things are right now. At least it beats the hell out of the Windows model. And it *could* still lead to further acceptance of and demand for even more openness. Like burgers or crack: Give 'em a taste, maybe they'll like it and want more. And maybe by then you'll have earned enough clout that you'll be *able* to given them more. The world may not be ready for full-on Stallman openness yet, but the mixed model at least gets the foot in the door. It's a step in the right direction. I have argued, on the contrary, that the mixed model is the best one, not pure open or closed source: http://www.phoronix.com/scan.php?page=articleitem=sprewell_licensing I think the evidence is in that my article from four years ago called it right. :) Could be. That is a fairly convincing article, at least for the time limit version of mixed closed/open. But in any case, even if one takes the Stallman all must be open, period stance, the mixed stuff is STILL a step in the desired direction. So regardless of whether or not mixed is the final end-goal, it's still a good direction to taking.
Re: code cleanup in druntime and phobos
On 8/30/2014 8:56 AM, Iain Buclaw via Digitalmars-d wrote: 'Thanks for your contribution and for helping make D better'. This is what our attitude must be.
Fixing Issue 1829
A little over 4 months ago, I submitted a PR (https://github.com/D-Programming-Language/dmd/pull/3483) to DMD to fix this very old issue, which did at first have minor issues with it that were promptly fixed. The PR itself has never actually been reviewed, even though I've tried on a couple of occasions to get more eyes on it. It's for this reason that I write this to ask, would anyone be willing to review this PR fixing an ancient issue?
Re: code cleanup in druntime and phobos
On 8/30/2014 7:37 AM, Daniel Murphy wrote: Ola Fosheim Grøstad wrote in message news:pmrjlrkkaaiguefnq...@forum.dlang.org... Here is a good reason: «I have no interest in learning github, and I personally don't care if you accept this patch, but here you have it in case you want to improve your system». Here is another good reason: «Figuring out the D process is wy down on my todo list, maybe sometime next month, next year, next…» If it takes longer to work out how to submit a pull request than make your patch, your patch probably wasn't worth doing. While we of course would prefer that all contributors use github, there is another side. I, of course, use lots of different software products. I often encounter bugs (obviously). So what to do about those bugs? When I try to report them, I discover far more often than not: 1. the vendor's web site has no mechanism for reporting bugs 2. if there is a mechanism, the vendor throws all sorts of annoying roadblocks in first, such as: a. forcing me to click through their faq b. having a 'keyhole' text entry box for the bug report (I defeat these by composing the bug report elsewhere and then cutpaste it into the keyhole) c. putting a limit like of 300 characters for the bug report d. making me create an account in order to submit the report e. rejecting my bug report because I didn't fill in the form exactly right 3. the vendor will tell me I'm a unique snowflake and nobody else has the problems I reported so it won't be fixed, and btw, I should buy their upgrade for $75. It isn't just paid software, try submitting a bug report to Thunderbird Mail. [One of the most miserable bug reporting systems is the Patent Office's form for submitting prior art. It's hell just trying to figure out how to fill out the form correctly, and of course if you do anything wrong it just throws it on the floor.] - The end result of all this is I very rarely submit bug reports anymore. If the maker makes it hard for me to submit one, I infer they don't want to hear about bug reports, so why bother? (I also cannot recall any vendor actually fixing a bug I reported, EVER, in 30 years.) - Bottom line is, if someone wants to submit a patch via bugzilla, or even email, we should be accommodating, or at least not blow him off. I've often added Bugzilla issues for things I've received via email.
Re: Looking to hire: 2-3 programmers, candidates will likely need to learn D.
On 8/31/14, 8:55 AM, Vladimir Panteleev wrote: How's it lookin' now? Awes, thanks! -- Andrei
Re: Encapsulating trust
On Sunday, 31 August 2014 at 13:47:42 UTC, Dmitry Olshansky wrote: What do you guys think? I'd say add trusted to those function names: trustedCall trustedAddrOf Because: - call could mean a lot of things. It's not imidiatly obvious that it is meant for being trusted. - addrOf is *also* used as an alternative for , especially in generic code, when you need the address of an attribute, as that attribute could actually be a property function. EG: auto p = addrOf(r.front); Nothing here implies trust. Also, implementation wise, wouldn't it be possible to instead make `call` a template aliases itself away to `fun`, but with different attributes? The `auto fun(Args)(auto ref Args args)` tube approach has the disadvantages that it: - prevents return by ref - fails perfect forwarding of lvalues into rvalues.
Re: [OT] Microsoft filled patent applications for scoped and immutable types
On Sunday, 31 August 2014 at 19:58:03 UTC, Nick Sabalausky wrote: Could be. That is a fairly convincing article, at least for the time limit version of mixed closed/open. Glad to hear that. :) Nobody has really tried my time-limited version, which I believe is the final step. But in any case, even if one takes the Stallman all must be open, period stance, the mixed stuff is STILL a step in the desired direction. So regardless of whether or not mixed is the final end-goal, it's still a good direction to taking. This is what guys like Stallman or ketmar don't seem to get, that mixed-source still leads to _more_ open source, even if it isn't _pure_ open source. For example, the success of Android means that there's more open source code running on computing devices than ever before, a billion at last count, even if it's not _pure_ open source. As you said, that pragmatic mixed approach has done more to advance open source than their purist approach ever will. And my time-limited model advances it even more, by making sure you get the source to all the binary blobs eventually.
Re: DIP(?) Warning to facilitate porting to other archs
Am Sat, 03 May 2014 03:17:23 +0200 schrieb Jonathan M Davis via Digitalmars-d digitalmars-d@puremagic.com: […] Putting warnings in the compiler always seems to result in forcing people to change their code to make the compiler shut up about something that is perfectly fine. - Jonathan M Davis I agree with you about warnings about clarity of operator precedence and the like, where it is just a matter of style. But I don't see what that has to do with this issue and code like: size_t = ulong; // breaks when porting from 64 to 32 bit uint = size_t; // breaks when porting from 32 to 64 bit which is obviously broken, but accepted. I would really like to force people to change their code to make the compiler shut up. See some of the linked bugs for examples: https://issues.dlang.org/show_bug.cgi?id=5063#c4 Now we have 3 bad options and no good one: :( - add warnings to dmd, which should never have real warnings and dozens of flags to control them - make size_t a distinct type, which is unfeasible to implement and is likely to break _something_ - keep the status quo with libraries that don't compile and try to educate people about the issue -- Marco
Re: [OT] Microsoft filled patent applications for scoped and immutable types
On 31 August 2014 05:24, Nick Sabalausky via Digitalmars-d digitalmars-d@puremagic.com wrote: On 8/30/2014 9:49 PM, Era Scarecrow wrote: Although M$ doing this seems more like a move in order to muscle their way in for other things. Take the actions of their actions regarding Novell. http://www.gnu.org/licenses/rms-why-gplv3.html [quote] Another threat that GPLv3 resists is that of patent deals like the Novell-Microsoft pact. Microsoft wants to use its thousands of patents to make users pay Microsoft for the privilege of running GNU/Linux, and made this pact to try to achieve that. The deal offers rather limited protection from Microsoft patents to Novell's customers. [/quote] It feels like they are trying to make a monopoly where they are the only ones able to make compilers, and anything with 'more useful features' have to pay them royalties or get a very expensive limited license in order to be left alone. Of course there's other cases similar where idiots try to copyright the symbol pi, so they can then exploit it in order to sue companies and individuals for easy cash... Y'know, that link above is a good example of why FSF and GPL bug me. Don't get me wrong, I'm not a GPL vs BSD guy. I genuinely believe both have their place, and the difference lies in is what your, and your project's, exact goals are. And I completely agree with the full extent of Stallman's famously ultra-strict villainization of closed-box proprietary shackle-ware. That shit pisses me off far more than it does most people. And I *do* appreciate that GPL, unlike BSD, can *realistically* be cross-licensed with a commercial license in a meaningful way and used on paid commercial software (at least, I *think* so, based on what little anyone actually *can* comprehend of the incomprehensible GPL). GPL can be summarised in four simple freedoms. Nothing complicated there. In any case, you do know that there are paid gpl software too, right? Ardour is a good example of this. http://ardour.org/download.html I *do* agree with Stallman's views, even most of the more extreme ones, I *want* to like FSF and GPL, but... ...but then there's stuff like that link above. He keeps harping on how MS is being evil, and GPL v3 prevents the evil MS is attempting...but jesus crap he *WILL NOT* spend ONE FUCKING WORD on ***HOW*** the shit any of that supposedly works. We're supposed to just blindly accept all of it just like the good little corporate whores he keeps trying to crusade that we *shouldn't* be. Shit. The FSF constantly sounds just like one of those worthless pro-issue #XX / anti-issue #XX asshats we have to put up with every voting season: snip Having spoken to RMS in person, I can say that you are far from the reality of their stance on promoting free software. This is the sort of attitude I'd expect from a sorely misunderstood teenager. Your heart might be in the right place, but your actually insulting both sides of the border. Iain.
Slightly OT - Survey
As part of my Degree in ICT at CPIT, I do a largish project at the end. Called Industry project. My own is in house, which I proposed. Essentially its a web service to aid learning. It would really help me if anyone who falls under either, student, educator or corporate (admin) to fill in my survey[0] as part of requirement gathering. For the industry project there is a panel at the end where by the project is essentially put on display and I do a presentation about it. There will also be a day where all the posters for them will be displayed publicly so that people in industry can see, and talk to me about it. I hope by that time I would have made something to show in terms of D and web services. The survey's analytical tool is indeed in D. The survey will be open till 8th of September UTC+12 most likely 10am. Also for any dmd commiters out there can you please look at PR[1] for feedback, its blocking me for Cmsed. [0] http://goo.gl/kAPU5t [1] https://github.com/D-Programming-Language/dmd/pull/3921
Re: [OT] Microsoft filled patent applications for scoped and immutable types
On 31 August 2014 06:53, Nick Sabalausky via Digitalmars-d digitalmars-d@puremagic.com wrote: I know FSF prefers free over the open I've been using. But really, everybody knows what open and open source mean, and it's *not* confusing and ambiguous. So the whole free obsession is just semantic pedantry that introduces ambiguity and confusion (free as in...what, which 'free' now? Because Linux...I mean GNU/Linux...is both types, right?) and distracts people from the more important matters. I find that using the term open source is like using the term cloud computing. It's a buzzword to make free software sound more attractive to commercial businesses. By preferring the term free over open, you are merely pointing out that a Waste Management and Disposal Technician is just a Bin-man, no matter what angle you take on it. Iain.
Re: [OT] Microsoft filled patent applications for scoped and immutable types
On 8/31/2014 4:43 PM, Joakim wrote: On Sunday, 31 August 2014 at 19:58:03 UTC, Nick Sabalausky wrote: Could be. That is a fairly convincing article, at least for the time limit version of mixed closed/open. Glad to hear that. :) Nobody has really tried my time-limited version, which I believe is the final step. But in any case, even if one takes the Stallman all must be open, period stance, the mixed stuff is STILL a step in the desired direction. So regardless of whether or not mixed is the final end-goal, it's still a good direction to taking. This is what guys like Stallman or ketmar don't seem to get, that mixed-source still leads to _more_ open source, even if it isn't _pure_ open source. I suspect they may actually get *that* much of it...I'm just not sure they seem to *care*. I get the impression it's basically toddler-style it's not EXACTLY what I want so I don't want ANY of it! pouting. Anyway, either way, that's probably just splitting hairs. Regardless of their exact level of awareness, the end result is the same. For example, the success of Android means that there's more open source code running on computing devices than ever before, a billion at last count, even if it's not _pure_ open source. As you said, that pragmatic mixed approach has done more to advance open source than their purist approach ever will. And my time-limited model advances it even more, by making sure you get the source to all the binary blobs eventually. Exactly. And if Google had insisted on *pure* OSS for android, you *Know* the carriers (and to a lesser extent, manufacturers) *NEVER* would have gone for it. And then there we'd be, stuck with Apple owning a 1990's-MS-style monopoly, but worse because of the iOS's third-party restrictions and gatekeeping.
why does DMD compile hello world to about 500 _kilobytes_ on Mac OS X [x86_64]?!?
Dear all, Me: a very experienced computer programmer, a newbie to D. The test program: import std.stdio; void main() { writeln(hello world!); } The result: ls -l foo -rwxr-xr-x 1 Abe wheel 502064 Aug 31 18:47 foo file foo foo: Mach-O 64-bit executable x86_64 ./foo hello world! Please note: 502064 bytes!!! [for the curious: 490.296875 kilobytes] The compiler: DMD64 D Compiler v2.066.0 Copyright (c) 1999-2014 by Digital Mars written by Walter Bright Documentation: http://dlang.org/ The OS: Mac OS X 10.6.8 The question: why is Hello World so frickin` huge?!? [FYI: using dmd -O instead of plan dmd makes no difference in the size of the executable] — Abe
Oh, and I almost forgot: does this problem exist on any other platforms too? …
… that is, the problem whereby DMD produces _huge_ executables for tiny programs.
line counts of outputs of nm from the object and executable from the above source code
nm foo.o | wc -l 176 nm foo | wc -l 2162
Re: why does DMD compile hello world to about 500 _kilobytes_ on Mac OS X [x86_64]?!?
On Sunday, 31 August 2014 at 23:51:41 UTC, Abe wrote: writeln(hello world!); The std.stdio package imports most the standard library, so using it means a lot of library code is linked into your executable too. About 200kb is the D runtime code and the rest is standard library code.
Re: The std.stdio package imports most the standard library etc.
Thanks, Adam. Is this roughly the same on all relevant platforms for DMD? I was thinking [hoping?] that maybe this was a problem vis-a-vis the Mac OS X linker, i.e. a situation such that the linker isn`t dropping anything from the referenced libraries, even when the majority of the stuff in those library files is not being used in the currently-being-linked object file. BTW: using strip [no special options] on the executable produces a steep drop in the length of the nm output, but only a small change in actual size: ls -l foo -rwxr-xr-x 1 Abe wheel 469112 Aug 31 19:08 foo nm foo | wc -l 1263 — Abe
Re: The std.stdio package imports most the standard library etc.
On Monday, 1 September 2014 at 00:10:25 UTC, Abe wrote: Is this roughly the same on all relevant platforms for DMD? Yeah. If you used printf instead of writeln, the size gets down to about 250K (on my linux anyway), which can then be stripped down to 160K, showing that the rest of the size comes from pulling in a lot of standard library code. The rest of that 160 K is the druntime library, stuff like thread support, memory management, etc. that is always present. It is possible to strip that out too and make really tiny executables (I've gone down to under 3KB before playing with this, as have other people working in the embedded space), but then you don't get any of the library and it is easier said than done. But you should compare this to other common programming language's sizes: * Java programs need the user to download like 20 MB of the JRE to run * Ditto for the .net/mono frameworks * The ruby interpreter on my computer is about 18 MB * etc etc etc Compared to them, D programs are small. The big difference is Java, .net, ruby, python, etc. are already popular enough to have their libraries/support code pre-installed on the user's computer. D programs, on the other hand, carry all their support code with them in each executable (they're statically linked) so they have better odds of just working without the user needing to install other stuff that they prolly don't already have.
Re: The std.stdio package imports most the standard library etc.
Compared to them, D programs are small. The big difference is Java, .net, ruby, python, etc. are already popular enough to have their libraries/support code pre-installed on the user's computer. D programs, on the other hand, carry all their support code with them in each executable (they're statically linked) so they have better odds of just working without the user needing to install other stuff that they prolly don't already have. Ah, yes. I was wondering why large amount of code originating in something called a standard library was apparently being shoved into an executable. I guess at this point in the life of Dlang, it is not yet realistic to expect users to have e.g. libdlang.so in their /usr/lib. It would be nice to have an option to use a systemwide library file and dynamically link it; that way, as a silly example, I could have 10 different D-based hello world-sized programs` executables and only one copy of the relevant library code [well, at least of _most_ of it]. BTW: I see what you meant about statically linked: ls -lh /opt/Digital_Mars_D/lib -r--r--r-- 1 Abe staff34M Aug 16 09:08 libphobos2.a … only an ar archive, no .dylib file [basically the Mac OS X equivalent of an .so file]. :-( Do you think DMD and Phobos2 could be massaged into giving us the dynamically-linked option with a small-enough amount of time effort, at least for the first platform to get that option? [I`m guessing that here, first effectively implies easiest to implement.] Do you know if GDC and/or LDC do this in a way that makes for small Hello Worlds? I haven`t yet successfully installed either one of those, sorry, so I can`t test it myself yet. Thanks again. — Abe
statically linked vs. Mac OS X
BTW: FYI: at least on recent-enough versions of Mac OS X, from what I have read, Apple has effectively forbidden _true_ static linking, i.e. executables with no dynamic-library dependencies whatsoever. Here`s the relevant result from the D-based hello world executable: otool -L foo foo: /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.11) /opt/GCC_4.8.1/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0) [obviously, that second line refers to a GCC that I build installed myself] — Abe
Re: If you used printf instead of writeln
On Monday, 1 September 2014 at 01:02:27 UTC, Abe wrote: BTW: FYI: at least on recent-enough versions of Mac OS X, from what I have read, Apple has effectively forbidden _true_ static linking, i.e. executables with no dynamic-library dependencies whatsoever. Here`s the relevant result from the D-based hello world executable: otool -L foo foo: /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.11) /opt/GCC_4.8.1/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0) [obviously, that second line refers to a GCC that I build installed myself] — Abe
Re: The std.stdio package imports most the standard library etc.
On Monday, 1 September 2014 at 00:56:35 UTC, Abe wrote: It would be nice to have an option to use a systemwide library file and dynamically link it; that way, as a silly example, You can do it on Linux with dmd right now (use dmd -defaultlib=libphobos2.so when building), but I don't know about the Mac, and not sure about Windows either.
Re: If you used printf instead of writeln […] [ignore previous post]
Sorry: accidentally hit something on the keyboard that the Mac and/or Chromium interpreted as post it right now. :-( This msg. is to confirm that If you used printf instead of writeln […], from an above msg. from Adam, is also correct on Mac OS X [64-bit Intel]. Given this source code: import core.stdc.stdio; void main() { printf(hello world!\n); } … the size is now down to 334744 bytes [w/o any stripping], i.e. 326.8984375 kbytes for those so inclined. The length of the output from nm for _this_ executable is 1552 lines [again, w/o any stripping]. — Abe
Re: -defaultlib=libphobos2
You can do it on Linux with dmd right now (use dmd -defaultlib=libphobos2.so when building), but I don't know about the Mac, and not sure about Windows either. Well, it doesn`t look feasible with the current DMD for Mac OS X: cd /opt/Digital_Mars_D_2.066.0 find . -iname '*dylib' [nothing found] find . -iname '*dylib*' # please note the extra '*' at the end ./src/druntime/src/rt/dylib_fixes.c Reading ./src/druntime/src/rt/dylib_fixes.c seems to indicate that DMD has at least _some_ support for Mac OS X dynamic libraries, but IDK how much and under which circumstances. If anybody with a Windows installation of DMD would care to chime in, I`d be interested to read what that side of the triangle looks like vis-a-vis the linking and size-of-executable issue/issues. My thanks again to Adam. — Abe
Re: printf-based D code
Also: the same printf-based D code as I gave in my previous post results in the following [still Mac OS X 64-bit Intel]. nm bar.o | wc -l 22 strip bar nm bar | wc -l 915 — Abe
Re: [OT] Microsoft filled patent applications for scoped and immutable types
On Wednesday, 27 August 2014 at 21:19:47 UTC, Walter Bright wrote: On 8/27/2014 1:02 PM, Jérôme M. Berger wrote: So for patent number 20140196015, the application number is 13/734762 and for patent number 20140196008, the application number is 13/734750. Jerome Required fields (Patent Number) cannot be empty or the data entered is incorrectly formatted. The field contains over 9 characters which cannot be processed in the USPTO system. Walter, will it really become a threat for D? I have lot of hopes from D language.
Re: Voting: std.logger
On Sunday, 31 August 2014 at 09:56:29 UTC, Ola Fosheim Grøstad wrote: The logger I am most interested in writes to a circular buffer and uploads the log to a database on a crash so that the source of the crash can be identified. I am only interested in in logging execution, not preserved state without execution. Does this logger already exist, could I take a look at it? If not, if someone writes an appender for writing to the database, you could accomplish this goal with log4d using a buffer appender that triggers on fatal.
Re: [OT] Microsoft filled patent applications for scoped and immutable types
On 8/31/2014 8:26 PM, Kajal Sinha wrote: Walter, will it really become a threat for D? I have no idea.
Re: [OT] Microsoft filled patent applications for scoped and immutable types
On Sun, 2014-08-31 at 22:01 -0700, Walter Bright via Digitalmars-d wrote: On 8/31/2014 8:26 PM, Kajal Sinha wrote: Walter, will it really become a threat for D? I have no idea. There is a patent on multiply linked lists (cf. http://www.google.co.uk/patents/US7028023) but I am fairly sure it hasn't been asserted against anyone as yet. The US patent system is, in this regard, a complete shambles. It is so sad the US government is intent on imposing the same system on the rest of the world :-( I guess it must be a keep patent lawyers in work scheme. -- Russel. = Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.win...@ekiga.net 41 Buckmaster Roadm: +44 7770 465 077 xmpp: rus...@winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder signature.asc Description: This is a digitally signed message part
Re: [OT] Microsoft filled patent applications for scoped and immutable types
On Sunday, 31 August 2014 at 22:06:09 UTC, Iain Buclaw via Digitalmars-d wrote: GPL can be summarised in four simple freedoms. Nothing complicated there. The problems come up when you get into the details of how to write those freedoms into legalese, for example, the whole dynamic linking issue. While they now claim that dynamic linking requires full GPL compliance, that's not actually written in the GPLv2 license. In any case, you do know that there are paid gpl software too, right? Ardour is a good example of this. http://ardour.org/download.html I had not heard of Ardour using such a paid model, so I just looked it up. Turns out the lead dev of Ardour announced last month that he had to shift focus from the project because it isn't bringing in much money (http://lwn.net/Articles/604718/), which is exactly what I predicted in my article four years ago because it has happened countless times already. I'll note that the one guy who was able to build a sustainable business for a GPL software product before dual-licensing was the original ghostscript developer, who sold a closed GUI frontend along with the open GPL backend, which was apparently legal because the two were separate executables. He started a successful software company that made millions off this early mixed model decades ago.
Re: I can ask questions about dmd on windows here in this forum?
On 08/30/2014 10:37 PM, Cassio Butrico wrote: I was having trouble setting on my terminal in windows, I'm still trying to solve. In addition to what Vladimir Panteleev said, you should also select a Unicode font for your terminal like Lucida Console. Basically: 1) Set the code page to 65001 by chcp 65001 2) Select a Unicode font from the console window's menu. You can set those two for the entire system. (I don't remember how.) As Vladimir Panteleev said, you can set both of those from inside each program as well. Ali
Re: I can ask questions about dmd on windows here in this forum?
On Sunday, 31 August 2014 at 06:08:46 UTC, Ali Çehreli wrote: On 08/30/2014 10:37 PM, Cassio Butrico wrote: I was having trouble setting on my terminal in windows, I'm still trying to solve. In addition to what Vladimir Panteleev said, you should also select a Unicode font for your terminal like Lucida Console. Basically: 1) Set the code page to 65001 by chcp 65001 2) Select a Unicode font from the console window's menu. You can set those two for the entire system. (I don't remember how.) As Vladimir Panteleev said, you can set both of those from inside each program as well. Ali Ali Çehreli you is very attentive, answering for me. I do not know how to use SetConsoleCP or SetConsoleOutputCP on a progrtama in d. I'll try to find out.
Re: I can ask questions about dmd on windows here in this forum?
Ali Çehreli: Unless there is a specific reason not to, use 'string'. When you really need random access to characters, then use 'dstring'. So are the use cases for wstring limited? Bye, bearophile
Re: I can ask questions about dmd on windows here in this forum?
On 08/31/2014 12:37 AM, bearophile wrote: Ali Çehreli: Unless there is a specific reason not to, use 'string'. When you really need random access to characters, then use 'dstring'. So are the use cases for wstring limited? Bye, bearophile Yes, without real experience, I am under that impression. Let's see: - char is UTF-8. UTF-8 is a variable-length encoding, from 1 up to 6 bytes per character. - wchar is UTF-16. UTF-16 is a variable-length encoding, 2 or 4 bytes per character. - dchar is UTF-32. UTF-32 is a fixed-length encoding, exactly 4 bytes per characters. As I understand it, wchar would make sense when UTF-8 would take considerably more space than UTF-16 for a given text. Another case is when a wchar array is guaranteed to consist solely of 2-byte characters; it can then safely be used as a random access range. In contrast, a dchar array provides random access for any text but takes up more space for certain text than UTF-8 and UTF-16 (e.g. text consisting mostly of 1-byte characters in UTF-8 (e.g. ASCII)). So yes, wchar has limited use compared to the others. Ali
Re: I can ask questions about dmd on windows here in this forum?
On Sun, 31 Aug 2014 01:11:02 -0700 Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: On 08/31/2014 12:37 AM, bearophile wrote: Ali Çehreli: Unless there is a specific reason not to, use 'string'. When you really need random access to characters, then use 'dstring'. So are the use cases for wstring limited? Bye, bearophile Yes, without real experience, I am under that impression. Let's see: - char is UTF-8. UTF-8 is a variable-length encoding, from 1 up to 6 bytes per character. - wchar is UTF-16. UTF-16 is a variable-length encoding, 2 or 4 bytes per character. - dchar is UTF-32. UTF-32 is a fixed-length encoding, exactly 4 bytes per characters. As I understand it, wchar would make sense when UTF-8 would take considerably more space than UTF-16 for a given text. Another case is when a wchar array is guaranteed to consist solely of 2-byte characters; it can then safely be used as a random access range. In contrast, a dchar array provides random access for any text but takes up more space for certain text than UTF-8 and UTF-16 (e.g. text consisting mostly of 1-byte characters in UTF-8 (e.g. ASCII)). So yes, wchar has limited use compared to the others. The main use case for an array of wchar is to interact with Windows functions which use UTF-16. There may be rare cases to use it otherwise, but the average D program should just use string unless it needs random-access, in which case, it should use dstring. wstring is ultimately of marginal use. - Jonathan M Davis
Re: D daemon GC?
Last snippet works for me, dots get printed to the logfile as expected. Ok, it works now. Using the recommended _Exit() function with DMD 2.066 on Linux. Thanks you all for your help! Best regards, Jeroen
Re: D1: Error: duplicate union initialization for size
On 2014-08-31 04:53, Ali Çehreli wrote: On 08/30/2014 06:05 PM, jicman wrote: Really is or how one can fix it? This is the only time that I have found myself without answers with D. Strange. Maybe folks are not that into D1, but D1 was before D2. Any thoughts would be greatly appreciated. Even from Walter. :-) Thanks. I still think this is the same bug that I have linked before: https://issues.dlang.org/show_bug.cgi?id=8902 My guess is that it hasn't been ported to the D1 compiler yet. Dicebot or any other people who work for Sociomantic should be most helpful. At this point, I recommend that you ask on the main D forum. That might be the case but this code doesn't involve a union. Size is a struct. The fix for the issue above requires minimal changes [1]. Perhaps it's worth a try to port to D1. [1] https://github.com/D-Programming-Language/dmd/commit/840d88a6e539e9817cffdc4abe8ad6357897d54a -- /Jacob Carlborg
A significant performance difference
This is C++ code that solves one Euler problem: -- #include stdio.h #include map const unsigned int H = 9, W = 12; const int g[6][3] = {{7, 0, H - 3}, {1 + (1 H) + (1 (2 * H)), 0, H - 1}, {3 + (1 H), 0, H - 2}, {3 + (2 H), 0, H - 2}, {1 + (1 H) + (2 H), 0, H - 2}, {1 + (1 H) + (1 (H - 1)), 1, H - 1}}; int main() { unsigned long long p, i, k; unsigned int j, l; std::mapunsigned int, unsigned long long x, y; x[0] = 1; for (i = 0; i W; ++i) { y.clear(); while (!x.empty()) { j = x.begin()-first; p = x.begin()-second; x.erase(x.begin()); for (k = 0; k H; ++k) if ((j (1 k)) == 0) break; if (k == H) y[j H] += p; else for (l = 0; l 6; ++l) if (k = g[l][1] k = g[l][2]) if ((j (g[l][0] k)) == 0) x[j + (g[l][0] k)] += p; } x = y; } printf(%lld\n, y[0]); return 0; } -- I have translated it to D like this (I know in D there are nicer ways to write it, but I have tried to keep the look of the code as much similar as possible to the C++ code): -- import core.stdc.stdio; const uint H = 9, W = 12; const uint[3][6] g = [[7, 0, H - 3], [1 + (1 H) + (1 (2 * H)), 0, H - 1], [3 + (1 H), 0, H - 2], [3 + (2 H), 0, H - 2], [1 + (1 H) + (2 H), 0, H - 2], [1 + (1 H) + (1 (H - 1)), 1, H - 1]]; int main() { ulong p, i, k; uint j, l; ulong[uint] x, y; x[0] = 1; for (i = 0; i W; ++i) { y = null; while (x.length) { j = x.byKey.front; p = x.byValue.front; x.remove(cast(int)j); for (k = 0; k H; ++k) if ((j (1 k)) == 0) break; if (k == H) y[j H] += p; else for (l = 0; l 6; ++l) if (k = g[l][1] k = g[l][2]) if ((j (g[l][0] k)) == 0) x[j + (g[l][0] k)] += p; } x = y; } printf(%lld\n, y[0]); return 0; } -- The C++ code is much faster than the D code (I see the D code 30+ times slower with dmd and about like 20 times with ldc2). One difference between the C++ and D code is that the C++ map uses a search tree (red-black probably), while the D code uses a hash. To test that algorithmic difference, if I replace the map in the C++ code with a std::unordered_map (C++11): #include unordered_map ... std::unordered_mapunsigned int, unsigned long long x, y; then the run-time increases (more than two times) but it's still much faster than the D code. Is it possible to fix the D code to increase its performance (there are associative array libraries for D, but I have not tried them in this program). Bye, bearophile
Re: How to build dlang.org dd files
On Sunday, 31 August 2014 at 05:41:58 UTC, Mike wrote: I've been trying to update some documentation on dlang.org. The instructions at https://github.com/D-Programming-Language/dlang.org/blob/master/CONTRIBUTING.md say I should be able to do make -f posix.make file.html This doesn't seem to work, as I get no rule t omake target 'file.html'. I tried 'make -f posix.mak' and that requires dmd, druntime, and maybe a mess of other things, and takes forever. And ultimately it fails with 'No rule to make target 'release'. Stop.' Isn't there any easy one-liner I can use to render a single .dd file to html to test my changes? Thanks, Mike This seems to do it: dmd -c -o- macros.ddoc doc.ddoc -Df{ddoc_filename}.html {ddoc_filename}.dd If someone knows of a more official syntax, please let me know. Mike
alias and mixin
what the problem with this? alias myint = mixin(int); // - basic type expected blah blah blah... mixin alias unusable now, it blocks various cool templates and really frustrating(such things make D feels like some cheap limited language), is there any way to tell compiler explicitly use mixin result for aliasing like above?
Re: alias and mixin
On Sun, 31 Aug 2014 11:26:47 + evilrat via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: alias myint = mixin(int); // - basic type expected blah blah mixin(alias myint = ~int~;); ? signature.asc Description: PGP signature
Re: alias and mixin
On Sunday, 31 August 2014 at 11:43:03 UTC, ketmar via Digitalmars-d-learn wrote: On Sun, 31 Aug 2014 11:26:47 + evilrat via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: alias myint = mixin(int); // - basic type expected blah blah mixin(alias myint = ~int~;); ? wow, it works. i don't even think inverting it O_o you saved my day, thanks.
Re: How to build dlang.org dd files
dmd -c -o- macros.ddoc doc.ddoc -Df{ddoc_filename}.html {ddoc_filename}.dd If someone knows of a more official syntax, please let me know. I don't know of another syntax, but could you please put this somewhere on the wiki? Maybe in the cookbook section: http://wiki.dlang.org/Cookbook
Re: D daemon GC?
On Sunday, 31 August 2014 at 09:02:55 UTC, JD wrote: Last snippet works for me, dots get printed to the logfile as expected. Ok, it works now. Using the recommended _Exit() function with DMD 2.066 on Linux. Thanks you all for your help! Best regards, Jeroen On a side note, i've created daemons like this before but then i found a rather nice posix system call to do it all for me: extern (C) { /** * The daemon() function is for programs wishing to detach themselves * from the controlling terminal and run in the background as system * daemons. * * (This function forks, and if the fork(2) succeeds, the parent calls * _exit(2), so that further errors are seen by the child only.) On * success daemon() returns zero. If an error occurs, daemon() returns * -1 and sets errno to any of the errors specified for the fork(2) and * setsid(2). * * Params: * nochdir = If nochdir is zero, daemon() changes the calling process's * current working directory to the root directory (/); otherwise, * the current working directory is left unchanged. * noclose = If noclose is zero, daemon() redirects standard input, * standard output and standard error to /dev/null; otherwise, no * changes are made to these file descriptors. */ int daemon(int nochdir, int noclose); } This is a lot easier to use. :)
Tango Problems..
I have several files, which I am trying to import as modules to a central file. However, whyile trying to complie with dmd -L-ltango-dmd list of files space separated However, I am getting this error : /usr/lib/libtango-dmd.a(tango-io-Stdout-release.o): In function `_D5tango2io6stream6Format20__T12FormatOutputTaZ12FormatOutput6formatMFxAaYC5tango2io6stream6Format20__T12FormatOutputTaZ12FormatOutput': ./tango/io/Stdout.d:(.text._D5tango2io6stream6Format20__T12FormatOutputTaZ12FormatOutput6formatMFxAaYC5tango2io6stream6Format20__T12FormatOutputTaZ12FormatOutput+0x12b): undefined reference to `_D4core4stdc6stdarg6va_endFPvZv' /usr/lib/libtango-dmd.a(tango-io-Stdout-release.o): In function `_D5tango2io6stream6Format20__T12FormatOutputTaZ12FormatOutput8formatlnMFxAaYC5tango2io6stream6Format20__T12FormatOutputTaZ12FormatOutput': ./tango/io/Stdout.d:(.text._D5tango2io6stream6Format20__T12FormatOutputTaZ12FormatOutput8formatlnMFxAaYC5tango2io6stream6Format20__T12FormatOutputTaZ12FormatOutput+0x130): undefined reference to `_D4core4stdc6stdarg6va_endFPvZv' /usr/lib/libtango-dmd.a(tango-io-Stdout-release.o): In function `_D5tango2io6stream6Format20__T12FormatOutputTaZ12FormatOutput5printMFYC5tango2io6stream6Format20__T12FormatOutputTaZ12FormatOutput': ./tango/io/Stdout.d:(.text._D5tango2io6stream6Format20__T12FormatOutputTaZ12FormatOutput5printMFYC5tango2io6stream6Format20__T12FormatOutputTaZ12FormatOutput+0x131): undefined reference to `_D4core4stdc6stdarg6va_endFPvZv' /usr/lib/libtango-dmd.a(tango-io-Stdout-release.o): In function `_D5tango4text7convert6Layout13__T6LayoutTaZ6Layout6sprintMFAaAxaYAa': ./tango/io/Stdout.d:(.text._D5tango4text7convert6Layout13__T6LayoutTaZ6Layout6sprintMFAaAxaYAa+0x125): undefined reference to `_D4core4stdc6stdarg6va_endFPvZv' /usr/lib/libtango-dmd.a(tango-io-Stdout-release.o): In function `_D5tango4text7convert6Layout13__T6LayoutTaZ6Layout7convertMFAxaYAa': ./tango/io/Stdout.d:(.text._D5tango4text7convert6Layout13__T6LayoutTaZ6Layout7convertMFAxaYAa+0x11e): undefined reference to `_D4core4stdc6stdarg6va_endFPvZv' /usr/lib/libtango-dmd.a(tango-io-Stdout-release.o):./tango/io/Stdout.d:(.text._D5tango4text7convert6Layout13__T6LayoutTaZ6Layout7convertMFDFAxaZmAxaYk+0x114): more undefined references to `_D4core4stdc6stdarg6va_endFPvZv' follow I tried a small hellow owrld file, the same problem. Yes, the 64 bit linux system updated today, and since then, this is a problem - how do I start to look for cause and solve?
Re: alias and mixin
On Sunday, 31 August 2014 at 12:01:43 UTC, evilrat wrote: On Sunday, 31 August 2014 at 11:43:03 UTC, ketmar via Digitalmars-d-learn wrote: On Sun, 31 Aug 2014 11:26:47 + evilrat via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: alias myint = mixin(int); // - basic type expected blah blah mixin(alias myint = ~int~;); ? wow, it works. i don't even think inverting it O_o you saved my day, thanks. It is basically just an annoying grammar limitation that does not allow to use mixin / __traits as an identifier.
Re: alias and mixin
It is basically just an annoying grammar limitation that does not allow to use mixin / __traits as an identifier. The usual helper template: ``` alias helper(alias a) = a; ``` helps for aliasing __traits and anonymous function templates (x = x+1), but I don't see an easy solution for mixin inside the current language, apart from pushing the mixin outside.
Re: Tango Problems..
Oh, I am using netrunner linux with arch/manjaro core.
Re: alias and mixin
On Sunday, 31 August 2014 at 14:46:00 UTC, Philippe Sigaud via Digitalmars-d-learn wrote: It is basically just an annoying grammar limitation that does not allow to use mixin / __traits as an identifier. The usual helper template: ``` alias helper(alias a) = a; ``` helps for aliasing __traits and anonymous function templates (x = x+1), but I don't see an easy solution for mixin inside the current language, apart from pushing the mixin outside. I recommend slightly more generic form: template Alias(T...) if (T.length == 1) { alias Alias = T[0]; } it is quite helpful in templated code to be able to alias _anything_ But yeah, no fun for mixins :(
Re: Tango Problems..
From what I understand in the error message, the linker cannot find a druntime function: void core.stdc.stdarg.va_end(void*). I would advise to check that the druntime lib is in the import path. In your the dmd repository, you should have a dmd.conf file containing something like: [Environment64] DFLAGS=-I%@P%/../src/phobos -I%@P%/../src/druntime/import -L-L%@P%/../lib64 -L--export-dynamic (%@P% means the compiler path). This should help you to fix your command line adding for instance: -I/usr/local/lib/dmd/druntime/ In my dmd installation (2.066.0), the druntime is contained in libphobos.a/libphobos.so. Are you linking with libphobos? On 08/31/2014 03:53 PM, seany wrote: I have several files, which I am trying to import as modules to a central file. However, whyile trying to complie with dmd -L-ltango-dmd list of files space separated However, I am getting this error : /usr/lib/libtango-dmd.a(tango-io-Stdout-release.o): In function `_D5tango2io6stream6Format20__T12FormatOutputTaZ12FormatOutput6formatMFxAaYC5tango2io6stream6Format20__T12FormatOutputTaZ12FormatOutput': ./tango/io/Stdout.d:(.text._D5tango2io6stream6Format20__T12FormatOutputTaZ12FormatOutput6formatMFxAaYC5tango2io6stream6Format20__T12FormatOutputTaZ12FormatOutput+0x12b): undefined reference to `_D4core4stdc6stdarg6va_endFPvZv' /usr/lib/libtango-dmd.a(tango-io-Stdout-release.o): In function `_D5tango2io6stream6Format20__T12FormatOutputTaZ12FormatOutput8formatlnMFxAaYC5tango2io6stream6Format20__T12FormatOutputTaZ12FormatOutput': ./tango/io/Stdout.d:(.text._D5tango2io6stream6Format20__T12FormatOutputTaZ12FormatOutput8formatlnMFxAaYC5tango2io6stream6Format20__T12FormatOutputTaZ12FormatOutput+0x130): undefined reference to `_D4core4stdc6stdarg6va_endFPvZv' /usr/lib/libtango-dmd.a(tango-io-Stdout-release.o): In function `_D5tango2io6stream6Format20__T12FormatOutputTaZ12FormatOutput5printMFYC5tango2io6stream6Format20__T12FormatOutputTaZ12FormatOutput': ./tango/io/Stdout.d:(.text._D5tango2io6stream6Format20__T12FormatOutputTaZ12FormatOutput5printMFYC5tango2io6stream6Format20__T12FormatOutputTaZ12FormatOutput+0x131): undefined reference to `_D4core4stdc6stdarg6va_endFPvZv' /usr/lib/libtango-dmd.a(tango-io-Stdout-release.o): In function `_D5tango4text7convert6Layout13__T6LayoutTaZ6Layout6sprintMFAaAxaYAa': ./tango/io/Stdout.d:(.text._D5tango4text7convert6Layout13__T6LayoutTaZ6Layout6sprintMFAaAxaYAa+0x125): undefined reference to `_D4core4stdc6stdarg6va_endFPvZv' /usr/lib/libtango-dmd.a(tango-io-Stdout-release.o): In function `_D5tango4text7convert6Layout13__T6LayoutTaZ6Layout7convertMFAxaYAa': ./tango/io/Stdout.d:(.text._D5tango4text7convert6Layout13__T6LayoutTaZ6Layout7convertMFAxaYAa+0x11e): undefined reference to `_D4core4stdc6stdarg6va_endFPvZv' /usr/lib/libtango-dmd.a(tango-io-Stdout-release.o):./tango/io/Stdout.d:(.text._D5tango4text7convert6Layout13__T6LayoutTaZ6Layout7convertMFDFAxaZmAxaYk+0x114): more undefined references to `_D4core4stdc6stdarg6va_endFPvZv' follow I tried a small hellow owrld file, the same problem. Yes, the 64 bit linux system updated today, and since then, this is a problem - how do I start to look for cause and solve?
Re: Tango Problems..
On Sunday, 31 August 2014 at 15:40:04 UTC, Rémy Mouëza wrote: From what I understand in the error message, the linker cannot find a druntime function: void core.stdc.stdarg.va_end(void*). I would advise to check that the druntime lib is in the import path. In your the dmd repository, you should have a dmd.conf file containing something like: [Environment64] DFLAGS=-I%@P%/../src/phobos -I%@P%/../src/druntime/import -L-L%@P%/../lib64 -L--export-dynamic (%@P% means the compiler path). This should help you to fix your command line adding for instance: -I/usr/local/lib/dmd/druntime/ In my dmd installation (2.066.0), the druntime is contained in libphobos.a/libphobos.so. Are you linking with libphobos? This is what I have : Environment] DFLAGS=-I/usr/include/dlang/dmd -L-L/usr/lib -L-L/usr/lib32 -L--export-dynamic