Re: Why doesn't mktspec() use clock_gettime?

2015-01-12 Thread Jacob Carlborg via Digitalmars-d
On 2015-01-12 02:19, Jonathan M Davis via Digitalmars-d wrote: It's probably because Mac OS X doesn't have clock_gettime, even though it's POSIX. std.datetime.Clock.currTime currently uses gettimeofday for getting the wall clock time on OS X (and clock_gettime on the other POSIX systems),

Re: Why exceptions for error handling is so important

2015-01-12 Thread bearophile via Digitalmars-d
Walter Bright: I do understand that the packed error code technique can be made to work, but the inconvenience seems to be high. Apparently if the language syntax is designed for that style of functional programming, the inconvenience seems to be very low. Bye, bearophile

Re: Why exceptions for error handling is so important

2015-01-12 Thread via Digitalmars-d
On Monday, 12 January 2015 at 09:41:08 UTC, bearophile wrote: Walter Bright: I do understand that the packed error code technique can be made to work, but the inconvenience seems to be high. Apparently if the language syntax is designed for that style of functional programming, the

Re: core.stdc.* documentation

2015-01-12 Thread Jacob Carlborg via Digitalmars-d
On 2015-01-12 02:24, Andrei Alexandrescu wrote: Problem is not that, but instead the repeated description. -- Andrei How about folding symbols with the same documentation, like ditto does? -- /Jacob Carlborg

Re: Writing a small linux binary

2015-01-12 Thread Iain Buclaw via Digitalmars-d
On 12 January 2015 at 08:46, Mike via Digitalmars-d digitalmars-d@puremagic.com wrote: On Monday, 12 January 2015 at 05:59:36 UTC, NVolcz wrote: Can this be done in D? How easy is it? What about the runtime?

Re: Writing a small linux binary

2015-01-12 Thread Paulo Pinto via Digitalmars-d
On Monday, 12 January 2015 at 09:00:58 UTC, Iain Buclaw via Digitalmars-d wrote: On 12 January 2015 at 08:46, Mike via Digitalmars-d digitalmars-d@puremagic.com wrote: On Monday, 12 January 2015 at 05:59:36 UTC, NVolcz wrote: Can this be done in D? How easy is it? What about the runtime?

Re: Writing a small linux binary

2015-01-12 Thread Mike via Digitalmars-d
On Monday, 12 January 2015 at 05:59:36 UTC, NVolcz wrote: Can this be done in D? How easy is it? What about the runtime? https://www.reddit.com/r/programming/comments/2s1sgg/151byte_static_linux_binary_in_rust/ Here's a link to my 56 byte Hello, World! program for the ARM Cortex-M platform

Re: core.stdc.* documentation

2015-01-12 Thread Andrei Alexandrescu via Digitalmars-d
On 1/12/15 12:05 AM, Jacob Carlborg wrote: On 2015-01-12 02:24, Andrei Alexandrescu wrote: Problem is not that, but instead the repeated description. -- Andrei How about folding symbols with the same documentation, like ditto does? I used ditto to generate that. -- Andrei

Re: Writing a small linux binary

2015-01-12 Thread ketmar via Digitalmars-d
On Mon, 12 Jan 2015 05:59:35 + NVolcz via Digitalmars-d digitalmars-d@puremagic.com wrote: Can this be done in D? yes. How easy is it? it depends of your experience and readyness to live without phobos and GC. What about the runtime? you may need to write one which will include only

Re: Writing a small linux binary

2015-01-12 Thread Paulo Pinto via Digitalmars-d
On Monday, 12 January 2015 at 08:46:57 UTC, Mike wrote: On Monday, 12 January 2015 at 05:59:36 UTC, NVolcz wrote: Can this be done in D? How easy is it? What about the runtime? https://www.reddit.com/r/programming/comments/2s1sgg/151byte_static_linux_binary_in_rust/ Here's a link to my 56

Re: Why exceptions for error handling is so important

2015-01-12 Thread Walter Bright via Digitalmars-d
On 1/11/2015 11:53 PM, Tobias Pankrath wrote: On Monday, 12 January 2015 at 00:51:25 UTC, Walter Bright wrote: This matters very much for pipeline style programming (i.e. ranges and algorithms). Here is one approach to it: http://fsharpforfunandprofit.com/posts/recipe-part2/ I don't fully

Re: Is anyone working on a D source code formatting tool?

2015-01-12 Thread ketmar via Digitalmars-d
On Sun, 11 Jan 2015 13:15:22 -0800 Walter Bright via Digitalmars-d digitalmars-d@puremagic.com wrote: On 1/11/2015 11:50 AM, Andrei Alexandrescu wrote: On 1/11/15 10:48 AM, Walter Bright wrote: The main problem is what to do about comments, which don't fit into the grammar. In the first

Re: Foreach, return not exist the function.

2015-01-12 Thread Zaher Dirkey via Digitalmars-d
On Sunday, 11 January 2015 at 23:50:18 UTC, Ali Çehreli wrote: On 01/11/2015 12:25 PM, Zaher Dirkey wrote: reproduce example here http://dpaste.dzfl.pl/13fb453d0b1e That link doesn't work for me. (?) Does opApply return the delegate's return value ('b' below)? import std.stdio; struct S {

Re: Why exceptions for error handling is so important

2015-01-12 Thread Paulo Pinto via Digitalmars-d
On Monday, 12 January 2015 at 09:31:25 UTC, Walter Bright wrote: On 1/11/2015 11:53 PM, Tobias Pankrath wrote: On Monday, 12 January 2015 at 00:51:25 UTC, Walter Bright wrote: This matters very much for pipeline style programming (i.e. ranges and algorithms). Here is one approach to it:

Re: Why exceptions for error handling is so important

2015-01-12 Thread Adam D. Ruppe via Digitalmars-d
On Monday, 12 January 2015 at 11:43:26 UTC, Ola Fosheim Grøstad wrote: Does this mean that D will get fast EH? It is fast already...

Re: Thoughts on replacement languages (Reddit + D)

2015-01-12 Thread Adam D. Ruppe via Digitalmars-d
On Monday, 12 January 2015 at 11:04:45 UTC, francesco.cattoglio wrote: When the GC collects them the destructor runs close(), which in turn calls for some allocation (e.g: allocates for a string to send to the logger), Do you have to log? I've never had a problem calling C free functions in

Re: Why exceptions for error handling is so important

2015-01-12 Thread via Digitalmars-d
On Monday, 12 January 2015 at 13:25:26 UTC, Adam D. Ruppe wrote: On Monday, 12 January 2015 at 11:43:26 UTC, Ola Fosheim Grøstad wrote: Does this mean that D will get fast EH? It is fast already... What makes you say that? Doesn't D still use the standard zero-cost EH that was created for

Re: core.atomic: atomicFence, atomicLoad, atomicStore

2015-01-12 Thread John Colvin via Digitalmars-d-learn
On Monday, 12 January 2015 at 13:37:19 UTC, ref2401 wrote: Thanks for the links. I have shared class instance. There are two threads which can read/write fields of the class. As i understand i can declare class as synchronized or i can read/write using atomicLoad/atomicStore. What's the

Re: casting SysTime to ubyte[]

2015-01-12 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/12/15 8:59 AM, Laeeth Isharc wrote: import std.datetime; import std.stdio; import std.conv; void main(string[] arg) { auto a=Clock.currTime(); auto b=cast(ubyte[])a; writefln(%s,b); } how do i get the time as a binary representation I can write to a file? You can always

Re: Thoughts on replacement languages (Reddit + D)

2015-01-12 Thread aldanor via Digitalmars-d
On Monday, 12 January 2015 at 11:04:45 UTC, francesco.cattoglio wrote: On Sunday, 11 January 2015 at 19:30:59 UTC, ponce wrote: When does invalidMemoryOperationError happen and how do you avoid it? Typical example: using (a slightly outdated version of) gfm library, I have few gfm objects

Re: Thoughts on replacement languages (Reddit + D)

2015-01-12 Thread francesco.cattoglio via Digitalmars-d
On Monday, 12 January 2015 at 12:23:51 UTC, ponce wrote: Especially since destructors called by GC would release resources from the wrong thread, at the wrong moment, etc. Yeah, I almost forgot about this: destructing GC resources interacting with OpenGL was sooo fun :P

[almostOT] Shared experience from GUI toolkit development

2015-01-12 Thread eles via Digitalmars-d-dwt
No, not my experience, and not about DWT, but seems to be the closest forum that allows posting this. From the Ultimate++ library developers: http://www.ultimatepp.org/www$uppweb$overview$en-us.html Who owns widgets One of the things we discovered over our countless experiments with C++ GUI

Re: Could D compete in a competition like this?

2015-01-12 Thread CraigDillabaugh via Digitalmars-d
On Monday, 12 January 2015 at 07:19:16 UTC, Ola Fosheim Grøstad wrote: On Monday, 12 January 2015 at 03:35:32 UTC, Craig Dillabaugh wrote: On Sunday, 11 January 2015 at 13:10:12 UTC, Ola Fosheim Grøstad wrote: On Sunday, 11 January 2015 at 13:01:36 UTC, Gary Willoughby wrote: Could D compete

Re: Why exceptions for error handling is so important

2015-01-12 Thread Martin Nowak via Digitalmars-d
On Monday, 12 January 2015 at 00:51:25 UTC, Walter Bright wrote: On 1/11/2015 5:06 AM, Dicebot wrote: What is your opinion of approach advertised by various functional languages and now also Rust? Where you return error code packed with actual data and can't access data without visiting error

casting SysTime to ubyte[]

2015-01-12 Thread Laeeth Isharc via Digitalmars-d-learn
import std.datetime; import std.stdio; import std.conv; void main(string[] arg) { auto a=Clock.currTime(); auto b=cast(ubyte[])a; writefln(%s,b); } how do i get the time as a binary representation I can write to a file? Thanks.

Re: Why exceptions for error handling is so important

2015-01-12 Thread John Colvin via Digitalmars-d
On Monday, 12 January 2015 at 11:09:01 UTC, Walter Bright wrote: On 1/12/2015 3:02 AM, Tobias Pankrath wrote: As far as I understand is, it requires each component to settle on the same discriminated union that packs the error and result, which he calles Result but is usually Choice in F#.

Re: core.atomic: atomicFence, atomicLoad, atomicStore

2015-01-12 Thread ref2401 via Digitalmars-d-learn
Thanks for the links. I have shared class instance. There are two threads which can read/write fields of the class. As i understand i can declare class as synchronized or i can read/write using atomicLoad/atomicStore. What's the difference between these two approaches? In what circumstances

Re: Thoughts on replacement languages (Reddit + D)

2015-01-12 Thread Szymon Gatner via Digitalmars-d
On Monday, 12 January 2015 at 00:33:52 UTC, Andrei Alexandrescu wrote: On 1/11/15 4:33 PM, MattCoder wrote: On Sunday, 11 January 2015 at 23:27:34 UTC, Nick B wrote: Perhaps its better to have a number (average or mean) than no number. Just ask 50 or 100 uers (or more) for their number of

Re: Is anyone working on a D source code formatting tool?

2015-01-12 Thread Jacob Carlborg via Digitalmars-d
On 2015-01-11 19:48, Walter Bright wrote: The main problem is what to do about comments, which don't fit into the grammar. Both Clang and Eclipse JDT provide API's for accessing comments. -- /Jacob Carlborg

Re: Is anyone working on a D source code formatting tool?

2015-01-12 Thread Jacob Carlborg via Digitalmars-d
On 2015-01-12 09:11, ketmar via Digitalmars-d wrote: it's easy: put it before `for`. /*comment*/ for (...) or just ignore it. and i must confess that i've never seen comment like this in my lifetime. I agree. clang-format manage to keep it in the same place. -- /Jacob Carlborg

Re: casting SysTime to ubyte[]

2015-01-12 Thread Daniel Kozák via Digitalmars-d-learn
V Mon, 12 Jan 2015 13:59:27 + Laeeth Isharc via Digitalmars-d-learn digitalmars-d-learn@puremagic.com napsáno: import std.datetime; import std.stdio; import std.conv; void main(string[] arg) { auto a=Clock.currTime(); auto b=cast(ubyte[])a; writefln(%s,b); }

Re: Thoughts on replacement languages (Reddit + D)

2015-01-12 Thread francesco.cattoglio via Digitalmars-d
On Monday, 12 January 2015 at 13:27:55 UTC, Adam D. Ruppe wrote: On Monday, 12 January 2015 at 11:04:45 UTC, francesco.cattoglio wrote: When the GC collects them the destructor runs close(), which in turn calls for some allocation (e.g: allocates for a string to send to the logger), Do you

Re: Is anyone working on a D source code formatting tool?

2015-01-12 Thread Martin Nowak via Digitalmars-d
On Monday, 12 January 2015 at 01:53:20 UTC, Brian Schott wrote: On Saturday, 10 January 2015 at 20:18:03 UTC, Walter Bright wrote: Has someone made a dfmt, like http://gofmt.com/ ? https://github.com/Hackerpilot/dfmt The above is the work of one afternoon and not well tested. Thanks Brian,

Re: GSOC - Holiday Edition

2015-01-12 Thread CraigDillabaugh via Digitalmars-d
On Sunday, 11 January 2015 at 12:53:53 UTC, Russel Winder via Digitalmars-d wrote: On Sat, 2015-01-10 at 19:30 +, Craig Dillabaugh via Digitalmars-d wrote: 8) Russel Winder and QML ... see #4. Should we drop QML support from our GSOC due to:

Re: Thoughts on replacement languages (Reddit + D)

2015-01-12 Thread via Digitalmars-d
On Sunday, 11 January 2015 at 18:25:39 UTC, francesco.cattoglio wrote: They have not broken any promise just yet! :P And I somehow hope they can really manage a high level of stability after discussing throughtly this much about every bikeshed topic (including the recent int/uint change).

Re: Why exceptions for error handling is so important

2015-01-12 Thread Iain Buclaw via Digitalmars-d
On 11 January 2015 at 10:48, Walter Bright via Digitalmars-d digitalmars-d@puremagic.com wrote: Over the last few days, I have been getting weird errors from various programs I run on Windows 7. Programs would just fail, or produce corrupt output (I'm looking at you, Windows Moviemaker). I

Re: endsWith - for a string vs an array of strings

2015-01-12 Thread Laeeth Isharc via Digitalmars-d-learn
Thanks for the help to everyone. It seems a common thing to want to check an array as one may not know the variables at compile time. Not that it's more than a few lines to do in D. But in terms of language adoption, small frictions can have large consequences over time. (Modern people

Re: Why exceptions for error handling is so important

2015-01-12 Thread Walter Bright via Digitalmars-d
On 1/12/2015 3:28 AM, Andrej Mitrovic via Digitalmars-d wrote: If you haven't read this I highly recommend it, just for the entertainment value: http://blog.seattlepi.com/microsoft/2008/06/24/full-text-an-epic-bill-gates-e-mail-rant/ Epic! But we all have such issues. And it ain't just

Re: core.stdc.* documentation

2015-01-12 Thread Steven Schveighoffer via Digitalmars-d
On 1/11/15 7:29 PM, Andrei Alexandrescu wrote: I just fixed documentation to generate docs for all symbols in core.stdc.complex. Looks unhelpful: http://erdani.com/d/library-prerelease/core/stdc/complex.html Any idea on how to make this better? Yeah, ddox should put the prototype in the

Re: Thoughts on replacement languages (Reddit + D)

2015-01-12 Thread ponce via Digitalmars-d
On Monday, 12 January 2015 at 11:04:45 UTC, francesco.cattoglio wrote: On Sunday, 11 January 2015 at 19:30:59 UTC, ponce wrote: When does invalidMemoryOperationError happen and how do you avoid it? Typical example: using (a slightly outdated version of) gfm library, I have few gfm objects

Re: Wrapping a C library with its own GC + classes vs refcounted structs

2015-01-12 Thread Laeeth Isharc via Digitalmars-d-learn
Laeeth. Thanks for the reply. Yes, this concerns my HDF5 wrapper project; the main concern is not that the memory consumption of course, but rather explicitly controlling lifetimes of the objects (especially objects like files -- so you are can be sure there are no zombie handles floating

Re: Why exceptions for error handling is so important

2015-01-12 Thread Walter Bright via Digitalmars-d
On 1/12/2015 3:02 AM, Tobias Pankrath wrote: As far as I understand is, it requires each component to settle on the same discriminated union that packs the error and result, which he calles Result but is usually Choice in F#. Now in D we use the opDot to chain components, which works since we

Re: Why exceptions for error handling is so important

2015-01-12 Thread Walter Bright via Digitalmars-d
On 1/12/2015 2:04 AM, Iain Buclaw via Digitalmars-d wrote: Up to this point, I you reminded me of a talk by Joe Armstrong (inventor of Erlang) https://www.youtube.com/watch?v=lKXe3HUG2l4 I've found another problem with Windows Moviemaker, it can read, but cannot write, movies larger than

Re: Why exceptions for error handling is so important

2015-01-12 Thread Dicebot via Digitalmars-d
On Monday, 12 January 2015 at 11:09:01 UTC, Walter Bright wrote: On 1/12/2015 3:02 AM, Tobias Pankrath wrote: As far as I understand is, it requires each component to settle on the same discriminated union that packs the error and result, which he calles Result but is usually Choice in F#.

Re: Why exceptions for error handling is so important

2015-01-12 Thread Andrej Mitrovic via Digitalmars-d
On 1/12/15, Walter Bright via Digitalmars-d digitalmars-d@puremagic.com wrote: I've found another problem with Windows Moviemaker, it can read, but cannot write, movies larger than 4Gb. Looks like some sort of internal 32 bit overflow. If you haven't read this I highly recommend it, just for

Re: Why exceptions for error handling is so important

2015-01-12 Thread Tobias Pankrath via Digitalmars-d
On Monday, 12 January 2015 at 09:31:25 UTC, Walter Bright wrote: On 1/11/2015 11:53 PM, Tobias Pankrath wrote: On Monday, 12 January 2015 at 00:51:25 UTC, Walter Bright wrote: This matters very much for pipeline style programming (i.e. ranges and algorithms). Here is one approach to it:

Re: Thoughts on replacement languages (Reddit + D)

2015-01-12 Thread francesco.cattoglio via Digitalmars-d
On Sunday, 11 January 2015 at 19:30:59 UTC, ponce wrote: When does invalidMemoryOperationError happen and how do you avoid it? Typical example: using (a slightly outdated version of) gfm library, I have few gfm objects lying around on which I forget to call a close() function. When the GC

Re: Why exceptions for error handling is so important

2015-01-12 Thread Tobias Pankrath via Digitalmars-d
On Monday, 12 January 2015 at 11:09:01 UTC, Walter Bright wrote: On 1/12/2015 3:02 AM, Tobias Pankrath wrote: As far as I understand is, it requires each component to settle on the same discriminated union that packs the error and result, which he calles Result but is usually Choice in F#.

Re: Is anyone working on a D source code formatting tool?

2015-01-12 Thread Russel Winder via Digitalmars-d
On Sun, 2015-01-11 at 11:19 -0800, Walter Bright via Digitalmars-d wrote: […] It would be in the DMD front end, so LDC and GDC would it automatically. s/it/get it/ ? What wouldn't be automatic would be the command line options and other surrounding bits and pieces. […] The rules are

Re: Why exceptions for error handling is so important

2015-01-12 Thread via Digitalmars-d
On Monday, 12 January 2015 at 11:41:06 UTC, Walter Bright wrote: For me the primary advantage of EH is put the code to deal with the error in the place where it is most appropriate to deal with it. With error codes, you have to deal with propagating Does this mean that D will get fast EH?

Re: Why exceptions for error handling is so important

2015-01-12 Thread Walter Bright via Digitalmars-d
On 1/12/2015 3:27 AM, Dicebot wrote: .. and have many other issues instead :) Right now my experience from some quick experiments with Rust seems to indicate that it is a good sort inconvenience for medium-to-big applications as it forces you to explicitly consider all possible exceptional

Re: Why exceptions for error handling is so important

2015-01-12 Thread Matthias Bentrup via Digitalmars-d
On Monday, 12 January 2015 at 13:54:18 UTC, Ola Fosheim Grøstad wrote: On Monday, 12 January 2015 at 13:25:26 UTC, Adam D. Ruppe wrote: On Monday, 12 January 2015 at 11:43:26 UTC, Ola Fosheim Grøstad wrote: Does this mean that D will get fast EH? It is fast already... What makes you say

Good post about out-of-the-box experience with D

2015-01-12 Thread Andrei Alexandrescu via Digitalmars-d
http://www.reddit.com/r/programming/comments/2s67en/evaluating_d_for_games/ I encourage you to comment on reddit instead of here. Andrei

Re: Set null as function array parameter

2015-01-12 Thread ketmar via Digitalmars-d-learn
On Mon, 12 Jan 2015 16:32:30 + Oleg via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: On Monday, 12 January 2015 at 15:59:43 UTC, Adam D. Ruppe wrote: Why are you using ref? Take that off and you can pass any array, including null, with ease. Because dynamic arrays are

Re: Thoughts on replacement languages (Reddit + D)

2015-01-12 Thread eles via Digitalmars-d
On Monday, 12 January 2015 at 14:34:41 UTC, francesco.cattoglio wrote: On Monday, 12 January 2015 at 13:27:55 UTC, Adam D. Ruppe wrote: On Monday, 12 January 2015 at 11:04:45 UTC, francesco.cattoglio wrote: To be completely honest, it is my only real gripe with D. Yes, but it's at the very

Re: Is anyone working on a D source code formatting tool?

2015-01-12 Thread Shammah Chancellor via Digitalmars-d
On 2015-01-12 03:23:28 +, deadalnix said: On Saturday, 10 January 2015 at 20:18:03 UTC, Walter Bright wrote: Has someone made a dfmt, like http://gofmt.com/ ? That is amongst the plans for libd. I'd be happy to support anyone that want to work on it :) This is part of the reason I

Re: Why exceptions for error handling is so important

2015-01-12 Thread via Digitalmars-d
On Monday, 12 January 2015 at 16:15:34 UTC, Matthias Bentrup wrote: The disadvantage of return code / union type error handling is that the successful case is as slow as the exceptional case. It is in a register...

Re: Set null as function array parameter

2015-01-12 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 12 January 2015 at 15:51:17 UTC, Oleg wrote: void foo(ref int[] param1) {} Why are you using ref? Take that off and you can pass any array, including null, with ease. The only difference is changes to length won't be seen outside the foo function.

Re: Set null as function array parameter

2015-01-12 Thread Oleg via Digitalmars-d-learn
On Monday, 12 January 2015 at 15:59:43 UTC, Adam D. Ruppe wrote: Why are you using ref? Take that off and you can pass any array, including null, with ease. Because dynamic arrays are passed by value to functions. Will it make another copy of array, if I'll pass array by value? Looks like

Re: GSOC - Holiday Edition

2015-01-12 Thread Russel Winder via Digitalmars-d
On Mon, 2015-01-12 at 15:16 +, CraigDillabaugh via Digitalmars-d wrote: […] Sounds good. I will see if filcuc is interested in being a Mentor. I am happy to be the backup mentor for this one. -- Russel. = Dr

Re: core.stdc.* documentation

2015-01-12 Thread Andrei Alexandrescu via Digitalmars-d
On 1/12/15 3:53 AM, Steven Schveighoffer wrote: On 1/11/15 7:29 PM, Andrei Alexandrescu wrote: I just fixed documentation to generate docs for all symbols in core.stdc.complex. Looks unhelpful: http://erdani.com/d/library-prerelease/core/stdc/complex.html Any idea on how to make this better?

Re: Thoughts on replacement languages (Reddit + D)

2015-01-12 Thread John Colvin via Digitalmars-d
On Monday, 12 January 2015 at 18:11:56 UTC, Dicebot wrote: On Sunday, 11 January 2015 at 17:35:19 UTC, Andrei Alexandrescu wrote: On 1/11/15 7:29 AM, Dicebot wrote: On Sunday, 11 January 2015 at 14:43:08 UTC, Ola Fosheim Grøstad wrote: Maybe we should do a comparison thread between D and Rust.

Re: Thoughts on replacement languages (Reddit + D)

2015-01-12 Thread Dicebot via Digitalmars-d
On Monday, 12 January 2015 at 18:55:49 UTC, John Colvin wrote: The import example misses that in D you can just do: import mod1 = my.long.mod1; import mod2 = my.long.mod2; I was originally intending to mention how this is possible but not pushed by language/compiler as the standard import

Re: Why exceptions for error handling is so important

2015-01-12 Thread via Digitalmars-d
On Monday, 12 January 2015 at 18:45:22 UTC, H. S. Teoh via Digitalmars-d wrote: The only sane way is to have the user specify a default value if the key wasn't found, since not all types have a null value (and besides, what if null is a valid value in the dictionary?). IOW something like

Re: Thoughts on replacement languages (Reddit + D)

2015-01-12 Thread Zach the Mystic via Digitalmars-d
On Monday, 12 January 2015 at 18:11:56 UTC, Dicebot wrote: I'd really appreciate someone doing the proof reading of my terrible English before reddit'ing away :) I wrote these down, which will get you through the introduction: My job is all about D programming language  -- the D Programming.

Re: GSOC - Holiday Edition

2015-01-12 Thread CraigDillabaugh via Digitalmars-d
On Monday, 12 January 2015 at 15:28:01 UTC, Russel Winder via Digitalmars-d wrote: On Mon, 2015-01-12 at 15:16 +, CraigDillabaugh via Digitalmars-d wrote: […] Sounds good. I will see if filcuc is interested in being a Mentor. I am happy to be the backup mentor for this one. Great.

Re: Is anyone working on a D source code formatting tool?

2015-01-12 Thread deadalnix via Digitalmars-d
On Monday, 12 January 2015 at 15:30:42 UTC, qznc wrote: So I started conceiving of a language in which even the *comments* were part of the AST. For, me this would be the aesthetic ideal. It just seemed like the next step in total AST integration. The clang-format approach is to make

D Beginner Trying Manual Memory Management

2015-01-12 Thread jmh530 via Digitalmars-d-learn
I'm new to D. I have some modest knowledge of C++, but am more familiar with scripting languages (Matlab, Python, R). D seems so much easier than C++ in a lot of ways (and I just learned about rdmd today, which is pretty cool). I am concerned about performance of D vs. C++, so I wanted to

Re: Is anyone working on a D source code formatting tool?

2015-01-12 Thread deadalnix via Digitalmars-d
On Monday, 12 January 2015 at 08:11:27 UTC, ketmar via Digitalmars-d wrote: it's easy: put it before `for`. /*comment*/ for (...) or just ignore it. and i must confess that i've never seen comment like this in my lifetime. You can't ignore. That is why building such tool in not that

Re: Why exceptions for error handling is so important

2015-01-12 Thread ketmar via Digitalmars-d
On Mon, 12 Jan 2015 18:11:01 + via Digitalmars-d digitalmars-d@puremagic.com wrote: returning state with exceptions (banging his head against a wall) NO. THIS NEVER HAS ANY SENSE. signature.asc Description: PGP signature

Re: Why exceptions for error handling is so important

2015-01-12 Thread Andrei Alexandrescu via Digitalmars-d
On 1/12/15 11:30 AM, Russel Winder via Digitalmars-d wrote: On Mon, 2015-01-12 at 10:43 -0800, H. S. Teoh via Digitalmars-d wrote: […] And what exactly should operator[] return if a key wasn't found? […] Go has an interesting solution, key lookup in a map return a pair (result, ok), if

Re: Why exceptions for error handling is so important

2015-01-12 Thread Tobias Pankrath via Digitalmars-d
On Monday, 12 January 2015 at 19:30:10 UTC, Russel Winder via Digitalmars-d wrote: On Mon, 2015-01-12 at 10:43 -0800, H. S. Teoh via Digitalmars-d wrote: […] And what exactly should operator[] return if a key wasn't found? […] Go has an interesting solution, key lookup in a map return

Re: Why exceptions for error handling is so important

2015-01-12 Thread deadalnix via Digitalmars-d
On Sunday, 11 January 2015 at 13:06:27 UTC, Dicebot wrote: What is your opinion of approach advertised by various functional languages and now also Rust? Where you return error code packed with actual data and can't access data without visiting error code too, compiler simply won't allow it.

Re: Is anyone working on a D source code formatting tool?

2015-01-12 Thread Brian Schott via Digitalmars-d
On Monday, 12 January 2015 at 15:30:34 UTC, qznc wrote: The clang-format approach is to make decisions based on the AST, but edit the byte array. dfix uses a similar approach. It uses the AST location information to make decisions while iterating through the token array. I think I will end

Re: Thoughts on replacement languages (Reddit + D)

2015-01-12 Thread Zach the Mystic via Digitalmars-d
On Monday, 12 January 2015 at 19:01:06 UTC, Dicebot wrote: On Monday, 12 January 2015 at 18:55:49 UTC, John Colvin wrote: The import example misses that in D you can just do: import mod1 = my.long.mod1; import mod2 = my.long.mod2; I was originally intending to mention how this is possible

Re: Thoughts on replacement languages (Reddit + D)

2015-01-12 Thread John Colvin via Digitalmars-d
On Monday, 12 January 2015 at 19:01:06 UTC, Dicebot wrote: On Monday, 12 January 2015 at 18:55:49 UTC, John Colvin wrote: The import example misses that in D you can just do: import mod1 = my.long.mod1; import mod2 = my.long.mod2; I was originally intending to mention how this is possible

Re: Is anyone working on a D source code formatting tool?

2015-01-12 Thread deadalnix via Digitalmars-d
On Monday, 12 January 2015 at 15:20:24 UTC, Shammah Chancellor wrote: On 2015-01-12 03:23:28 +, deadalnix said: On Saturday, 10 January 2015 at 20:18:03 UTC, Walter Bright wrote: Has someone made a dfmt, like http://gofmt.com/ ? That is amongst the plans for libd. I'd be happy to

Re: Is anyone working on a D source code formatting tool?

2015-01-12 Thread ketmar via Digitalmars-d
On Mon, 12 Jan 2015 19:17:47 + deadalnix via Digitalmars-d digitalmars-d@puremagic.com wrote: On Monday, 12 January 2015 at 08:11:27 UTC, ketmar via Digitalmars-d wrote: it's easy: put it before `for`. /*comment*/ for (...) or just ignore it. and i must confess that i've

Re: Why exceptions for error handling is so important

2015-01-12 Thread Russel Winder via Digitalmars-d
On Mon, 2015-01-12 at 09:54 -0800, H. S. Teoh via Digitalmars-d wrote: […] Yeah, exceptions are supposed to be ... well, *exceptions*, rather than the norm. :-) If you're using exceptions to do flow control, you're doing something wrong. […] Unless you are writing Python code. --

Re: Why exceptions for error handling is so important

2015-01-12 Thread Russel Winder via Digitalmars-d
On Mon, 2015-01-12 at 10:43 -0800, H. S. Teoh via Digitalmars-d wrote: […] And what exactly should operator[] return if a key wasn't found? […] Go has an interesting solution, key lookup in a map return a pair (result, ok), if lookup succeeded then result is the associated value, if ok is

Re: Thoughts on replacement languages (Reddit + D)

2015-01-12 Thread Andrei Alexandrescu via Digitalmars-d
On 1/12/15 11:01 AM, Dicebot wrote: On Monday, 12 January 2015 at 18:55:49 UTC, John Colvin wrote: The import example misses that in D you can just do: import mod1 = my.long.mod1; import mod2 = my.long.mod2; I was originally intending to mention how this is possible but not pushed by

Re: D Beginner Trying Manual Memory Management

2015-01-12 Thread ketmar via Digitalmars-d-learn
On Mon, 12 Jan 2015 19:29:53 + jmh530 via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: the proper answer is too long to write (it will be more an article that a forum answer ;-), so i'll just give you some directions: import std.typecons; { auto b = scoped!B(); //

Re: Why exceptions for error handling is so important

2015-01-12 Thread via Digitalmars-d
On Monday, 12 January 2015 at 19:24:35 UTC, ketmar via Digitalmars-d wrote: On Mon, 12 Jan 2015 18:11:01 + via Digitalmars-d digitalmars-d@puremagic.com wrote: returning state with exceptions (banging his head against a wall) NO. THIS NEVER HAS ANY SENSE. Sure it has. It is a state

Re: Thoughts on replacement languages (Reddit + D)

2015-01-12 Thread Dicebot via Digitalmars-d
On Monday, 12 January 2015 at 19:25:28 UTC, Andrei Alexandrescu wrote: On 1/12/15 11:01 AM, Dicebot wrote: On Monday, 12 January 2015 at 18:55:49 UTC, John Colvin wrote: The import example misses that in D you can just do: import mod1 = my.long.mod1; import mod2 = my.long.mod2; I was

Re: D Beginner Trying Manual Memory Management

2015-01-12 Thread jmh530 via Digitalmars-d-learn
Thanks for the reply, I wasn't familiar with scoped. I was aware that structs are on the stack and classes are on the heap in D, but I didn't know it was possible to put a class on the stack. Might be interesting to see how this is implemented. After looking up some more C++, I think what I

Re: D Beginner Trying Manual Memory Management

2015-01-12 Thread ketmar via Digitalmars-d-learn
On Mon, 12 Jan 2015 20:14:19 + jmh530 via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: Thanks for the reply, I wasn't familiar with scoped. I was aware that structs are on the stack and classes are on the heap in D, but I didn't know it was possible to put a class on the

Re: Why exceptions for error handling is so important

2015-01-12 Thread Dicebot via Digitalmars-d
On Monday, 12 January 2015 at 20:07:17 UTC, deadalnix wrote: On Sunday, 11 January 2015 at 13:06:27 UTC, Dicebot wrote: What is your opinion of approach advertised by various functional languages and now also Rust? Where you return error code packed with actual data and can't access data

Re: Why exceptions for error handling is so important

2015-01-12 Thread Walter Bright via Digitalmars-d
On 1/12/2015 10:11 AM, Ola Fosheim =?UTF-8?B?R3LDuHN0YWQi?= ola.fosheim.grostad+dl...@gmail.com wrote: There are plenty of situations where exceptions used for retries is the most sensible solution. Heck, that's even how x86 floating point exceptions work. There are plenty of situations where

Re: Why exceptions for error handling is so important

2015-01-12 Thread via Digitalmars-d
On Monday, 12 January 2015 at 20:07:17 UTC, deadalnix wrote: On Sunday, 11 January 2015 at 13:06:27 UTC, Dicebot wrote: What is your opinion of approach advertised by various functional languages and now also Rust? Where you return error code packed with actual data and can't access data

Re: Why exceptions for error handling is so important

2015-01-12 Thread deadalnix via Digitalmars-d
On Monday, 12 January 2015 at 13:33:40 UTC, John Colvin wrote: On Monday, 12 January 2015 at 11:09:01 UTC, Walter Bright wrote: On 1/12/2015 3:02 AM, Tobias Pankrath wrote: As far as I understand is, it requires each component to settle on the same discriminated union that packs the error and

Re: Thoughts on replacement languages (Reddit + D)

2015-01-12 Thread Dicebot via Digitalmars-d
On Monday, 12 January 2015 at 19:09:37 UTC, Zach the Mystic wrote: On Monday, 12 January 2015 at 18:11:56 UTC, Dicebot wrote: I'd really appreciate someone doing the proof reading of my terrible English before reddit'ing away :) I wrote these down, which will get you through the introduction:

Re: Thoughts on replacement languages (Reddit + D)

2015-01-12 Thread Zach the Mystic via Digitalmars-d
On Monday, 12 January 2015 at 21:13:10 UTC, Dicebot wrote: The section under Uncertain has a huge font size now and repeats what was just said. Have just fixed, beg my pardon. Please check again. Looks good. You're clear for launch! Oh wait... (looks up in the sky...)

Re: Why exceptions for error handling is so important

2015-01-12 Thread Dicebot via Digitalmars-d
On Monday, 12 January 2015 at 21:11:44 UTC, Walter Bright wrote: There's another downside to returning two values - extra code is generated, and it consumes another register. It allocates very scarce resources to rare cases - not a recipe for high performance. In server applications there is

Re: Thoughts on replacement languages (Reddit + D)

2015-01-12 Thread Dicebot via Digitalmars-d
On Monday, 12 January 2015 at 19:13:40 UTC, Zach the Mystic wrote: On Monday, 12 January 2015 at 19:01:06 UTC, Dicebot wrote: On Monday, 12 January 2015 at 18:55:49 UTC, John Colvin wrote: The import example misses that in D you can just do: import mod1 = my.long.mod1; import mod2 =

Re: Good post about out-of-the-box experience with D

2015-01-12 Thread weaselcat via Digitalmars-d
On Monday, 12 January 2015 at 16:16:30 UTC, Andrei Alexandrescu wrote: http://www.reddit.com/r/programming/comments/2s67en/evaluating_d_for_games/ Array!int(RefCounted!(Payload, cast(RefCountedAutoInitialize)0)(RefCountedStore(20D9590))) Why does std.container.array use refcounted? Seems like

Re: Why exceptions for error handling is so important

2015-01-12 Thread deadalnix via Digitalmars-d
On Monday, 12 January 2015 at 13:54:18 UTC, Ola Fosheim Grøstad wrote: On Monday, 12 January 2015 at 13:25:26 UTC, Adam D. Ruppe wrote: On Monday, 12 January 2015 at 11:43:26 UTC, Ola Fosheim Grøstad wrote: Does this mean that D will get fast EH? It is fast already... What makes you say

Article Evaluating D for games

2015-01-12 Thread desmond via Digitalmars-d
https://news.ycombinator.com/item?id=8874633 Someone evalutaing D for games. GC still seems to be the most hated D feature. D devs might want to reply ;)

Re: Why exceptions for error handling is so important

2015-01-12 Thread Walter Bright via Digitalmars-d
On 1/12/2015 10:06 AM, Tobias Müller wrote: On Mon, Jan 12, 2015 at 05:22:26PM +, Adam D. Ruppe via Digitalmars-d wrote: Yeah, exceptions are supposed to be ... well, *exceptions*, rather than the norm. :-) If you're using exceptions to do flow control, you're doing something wrong. But

Re: Good post about out-of-the-box experience with D

2015-01-12 Thread Tobias Pankrath via Digitalmars-d
On Monday, 12 January 2015 at 20:35:13 UTC, weaselcat wrote: On Monday, 12 January 2015 at 16:16:30 UTC, Andrei Alexandrescu wrote: http://www.reddit.com/r/programming/comments/2s67en/evaluating_d_for_games/ Array!int(RefCounted!(Payload,

Re: Why exceptions for error handling is so important

2015-01-12 Thread Walter Bright via Digitalmars-d
On 1/12/2015 11:30 AM, Russel Winder via Digitalmars-d wrote: Go has an interesting solution, key lookup in a map return a pair (result, ok), if lookup succeeded then result is the associated value, if ok is false then result is undefined. I quite like this. That's just putting the

  1   2   >