Dub and what it does

2013-12-23 Thread Russel Winder
For my (very) early stage GtkD program, my SCons script (using "all source at once") generates a 6MB executable that works. Dub appears to think that it is creating a .a archive and create 142MB of it. So how to create an executable with Dub? -- Russel. ===

Re: Idiomatic way to share mutable data?

2013-12-23 Thread Dan Killebrew
On Sunday, 22 December 2013 at 21:07:11 UTC, Charles McAnany wrote: Friends, I'm writing a little molecular simulator. Without boring you with the details, here's the gist of it: struct Atom{ double x, vx; double interaction(Atom a2){ return (a2.x-this.x)^^2; //more complicated

Re: GtkD - how to install

2013-12-23 Thread DLang Beginner
On Sunday, 22 December 2013 at 14:52:23 UTC, Russel Winder wrote: On Sun, 2013-12-22 at 13:29 +, Amateur wrote: Hello, I'm beginning with programming on desktop. After choosing which language is "da best" for me, I chose D. And now I want to create GUI applications, so I tried installing

Re: Error: module std.c.stdio import 'FHND_WCHAR' not found

2013-12-23 Thread David Held
On 12/22/2013 9:22 PM, David Held wrote: [...] D:\workspace\...>dmd bug1.d D:\D\dmd2\windows\bin\..\..\src\phobos\std\stdio.d(35): Error: module std.c.stdio import 'FHND_WCHAR' not found D:\D\dmd2\windows\bin\..\..\src\phobos\std\stdio.d(35): Error: module std.c.stdio import 'FHND_TEXT' not found

Re: Dub and what it does

2013-12-23 Thread Jacob Carlborg
On 2013-12-23 09:04, Russel Winder wrote: For my (very) early stage GtkD program, my SCons script (using "all source at once") generates a 6MB executable that works. Dub appears to think that it is creating a .a archive and create 142MB of it. So how to create an executable with Dub? You need t

Re: Dub and what it does

2013-12-23 Thread Jacob Carlborg
On 2013-12-23 10:52, Jacob Carlborg wrote: You need to add a package.json file to your project. http://code.dlang.org/package-format I accidentally sent the above message too soon. You either need to explicitly set the target type[1] to "executable" or make sure your project works with "aut

Re: GtkD - how to install

2013-12-23 Thread Alexandr Druzhinin
Show your package.json file and the project structure.

Re: Dub and what it does

2013-12-23 Thread Alexandr Druzhinin
23.12.2013 15:04, Russel Winder пишет: For my (very) early stage GtkD program, my SCons script (using "all source at once") generates a 6MB executable that works. Dub appears to think that it is creating a .a archive and create 142MB of it. So how to create an executable with Dub? I statically b

Re: Function with C calling convention but D mangling

2013-12-23 Thread Dicebot
On Monday, 23 December 2013 at 10:57:09 UTC, Benjamin Thaut wrote: Doing lots of C interfacing lately I wonder if there is a way to create a D function with C calling convention but D mangeling. I need this to place C callbacks onto functions inside D templates. Putting extern(C) before it does

Function with C calling convention but D mangling

2013-12-23 Thread Benjamin Thaut
Doing lots of C interfacing lately I wonder if there is a way to create a D function with C calling convention but D mangeling. I need this to place C callbacks onto functions inside D templates. Putting extern(C) before it does not work in this case. As extern(C) will also enforce C mangling I

Re: Function with C calling convention but D mangling

2013-12-23 Thread Benjamin Thaut
Am 23.12.2013 11:59, schrieb Dicebot: On Monday, 23 December 2013 at 10:57:09 UTC, Benjamin Thaut wrote: Doing lots of C interfacing lately I wonder if there is a way to create a D function with C calling convention but D mangeling. I need this to place C callbacks onto functions inside D templa

Re: GtkD - how to install

2013-12-23 Thread DLang Beginner
On Monday, 23 December 2013 at 10:08:09 UTC, Alexandr Druzhinin wrote: Show your package.json file and the project structure. https://www.dropbox.com/s/l3wwm84w85h5su2/dlang-gtk1.png https://www.dropbox.com/s/9vs4r9l3lvdw2y1/dlang-gtk2.png

Re: GtkD - how to install

2013-12-23 Thread Alexandr Druzhinin
23.12.2013 19:19, DLang Beginner пишет: On Monday, 23 December 2013 at 10:08:09 UTC, Alexandr Druzhinin wrote: Show your package.json file and the project structure. https://www.dropbox.com/s/l3wwm84w85h5su2/dlang-gtk1.png https://www.dropbox.com/s/9vs4r9l3lvdw2y1/dlang-gtk2.png You shouldn't

Re: GtkD - how to install

2013-12-23 Thread Alexandr Druzhinin
23.12.2013 22:52, DLang Beginner пишет: On Monday, 23 December 2013 at 13:50:29 UTC, Alexandr Druzhinin wrote: You shouldn't create your app inside gtkd structure. Try the following: cd mkdir test cd test dub init copy ~/Desktop/gtkd/source/app.d ./source/ copy ~/Desktop/gtkd/package.json . dub

Re: GtkD - how to install

2013-12-23 Thread DLang Beginner
On Monday, 23 December 2013 at 13:50:29 UTC, Alexandr Druzhinin wrote: 23.12.2013 19:19, DLang Beginner пишет: On Monday, 23 December 2013 at 10:08:09 UTC, Alexandr Druzhinin wrote: Show your package.json file and the project structure. https://www.dropbox.com/s/l3wwm84w85h5su2/dlang-gtk1.png

Re: Dub and what it does

2013-12-23 Thread Russel Winder
On Mon, 2013-12-23 at 10:57 +0100, Jacob Carlborg wrote: > On 2013-12-23 10:52, Jacob Carlborg wrote: > > > You need to add a package.json file to your project. > > > > http://code.dlang.org/package-format > > I accidentally sent the above message too soon. I was worried by that previous post as

Re: GtkD - how to install

2013-12-23 Thread DLang Beginner
On Monday, 23 December 2013 at 16:20:24 UTC, Alexandr Druzhinin wrote: 23.12.2013 22:52, DLang Beginner пишет: On Monday, 23 December 2013 at 13:50:29 UTC, Alexandr Druzhinin wrote: You shouldn't create your app inside gtkd structure. Try the following: cd mkdir test cd test dub init copy ~/De

Re: Dub and GtkD

2013-12-23 Thread Mike Wey
On 12/22/2013 10:00 PM, Artur Skawina wrote: On 12/22/13 20:21, Mike Wey wrote: On 12/22/2013 03:36 PM, Russel Winder wrote: Python now uses the reflection approach to providing a Python binding to the API: PyGTK has given way to PyGobject. Has the PyGobject approach been rejected for GtkD sta

Re: GtkD - how to install

2013-12-23 Thread Alexandr Druzhinin
23.12.2013 23:50, DLang Beginner пишет: On Monday, 23 December 2013 at 16:20:24 UTC, Alexandr Druzhinin wrote: 23.12.2013 22:52, DLang Beginner пишет: Either build this libraries like me or try to change dependency in package.json: "gtk-d": "~master" => "gtk-d:gtkd": "~master" You get error

Re: Suppressing UTFException / Squashing Bad Codepoints?

2013-12-23 Thread Brad Anderson
On Monday, 23 December 2013 at 20:48:08 UTC, John Carter wrote: This frustrated me in Ruby unicode too Typically i/o is the ultimate in "untrusted and untrustworthy" sources, coming usually from systems beyond my control. Likely to be corrupted, or maliciously crafted, or defective... Un

Suppressing UTFException / Squashing Bad Codepoints?

2013-12-23 Thread John Carter
This frustrated me in Ruby unicode too Typically i/o is the ultimate in "untrusted and untrustworthy" sources, coming usually from systems beyond my control. Likely to be corrupted, or maliciously crafted, or defective... Unfortunately not all sequences of bytes are valid UTF8. Thus inevita

My first D module - Critiques welcome.

2013-12-23 Thread John Carter
So I resolved to learn D, and try code as idiomatically as I could. So here is a trivial module that encodes and decodes roman numerals. https://bitbucket.org/JohnCarter/roman/src/9ec5b36b9973426f35b0ab9dfd595cb3b305e39e/roman.d?at=default I also attempted to do it in "Best Practice Test Driven

Re: "a[++i] = i" vs "a[i] = ++i"

2013-12-23 Thread David Held
On 12/21/2013 6:21 AM, bearophile wrote: aldanor: So should this considered a bug then and be filed? I think so. I have a related EnhancementRequest open, but I have to close it down or modify it... Bye, bearophile int mightUpdate(int& x) { ... return x; } { ... a[mightUpd

Re: My first D module - Critiques welcome.

2013-12-23 Thread bearophile
John Carter: I also attempted to do it in "Best Practice Test Driven Development" form I think it's important to write lot of unittests (and use other kind of tests, automatic testing like in Haskell, fuzzy testing, integration tests, smoke tests, etc), but I think Test Driven Development i

Re: Suppressing UTFException / Squashing Bad Codepoints?

2013-12-23 Thread John Carter
Eww. If I read the source correctly it mallocs a new array and runs down the original at least three times! (Four if you count peeks) Not to mention that it is completely unintegrated with stdio. Sigh! I miss the Good Old Days of 7-bit ASCII! ;-) On Tue, Dec 24, 2013 at 9:51 AM, Brad Anderson

Re: My first D module - Critiques welcome.

2013-12-23 Thread bearophile
do you have negative tests that tests the code raises an assertion Error when you give a 0 to the function? Have you also tried to give it a uint.max? Bye, bearophile

Re: My first D module - Critiques welcome.

2013-12-23 Thread Gary Willoughby
On Monday, 23 December 2013 at 21:34:34 UTC, John Carter wrote: So I resolved to learn D, and try code as idiomatically as I could. So here is a trivial module that encodes and decodes roman numerals. https://bitbucket.org/JohnCarter/roman/src/9ec5b36b9973426f35b0ab9dfd595cb3b305e39e/roman.d

Re: "a[++i] = i" vs "a[i] = ++i"

2013-12-23 Thread Charles Hixson
On 12/23/2013 12:39 PM, David Held wrote: On 12/21/2013 6:21 AM, bearophile wrote: aldanor: So should this considered a bug then and be filed? I think so. I have a related EnhancementRequest open, but I have to close it down or modify it... Bye, bearophile int mightUpdate(int& x) { ..

Re: "a[++i] = i" vs "a[i] = ++i"

2013-12-23 Thread H. S. Teoh
On Mon, Dec 23, 2013 at 04:12:05PM -0800, Charles Hixson wrote: > On 12/23/2013 12:39 PM, David Held wrote: [...] > >int mightUpdate(int& x) > >{ > >... > >return x; > >} > > > >{ > >... > >a[mightUpdate(i)] = mightUpdate(i); > >... > >} > > > >Is this also a bug? How would the

Re: My first D module - Critiques welcome.

2013-12-23 Thread Xinok
On Monday, 23 December 2013 at 21:34:34 UTC, John Carter wrote: So I resolved to learn D, and try code as idiomatically as I could. So here is a trivial module that encodes and decodes roman numerals. https://bitbucket.org/JohnCarter/roman/src/9ec5b36b9973426f35b0ab9dfd595cb3b305e39e/roman.d

Re: My first D module - Critiques welcome.

2013-12-23 Thread John Carter
Wow! Thanks for an excellent reply! I really appreciate it... On Tue, Dec 24, 2013 at 11:38 AM, bearophile wrote: > John Carter: > > > I also attempted to do it in "Best Practice Test Driven Development" form >> > > I think it's important to write lot of unittests (and use other kind of > test

Re: Suppressing UTFException / Squashing Bad Codepoints?

2013-12-23 Thread Brad Anderson
On Monday, 23 December 2013 at 22:41:47 UTC, John Carter wrote: Eww. If I read the source correctly it mallocs a new array and runs down the original at least three times! (Four if you count peeks) Not to mention that it is completely unintegrated with stdio. Sigh! I miss the Good Old Days o

Re: My first D module - Critiques welcome.

2013-12-23 Thread bearophile
John Carter: I'm storing the roman numerals as dchars. I have the vague hope this is more efficient than storing them as strings. From/to Roman numbers conversions are never performance-critical. It looks like premature optimization. What do you mean by "missing UCSF"? Sorry, it's UFCS

Re: My first D module - Critiques welcome.

2013-12-23 Thread John Carter
Thanks. Taken on board and fixes pushed. I would love away around that. >> > > http://dlang.org/phobos/std_exception.html > Tried using assertThown!AssertError but @safe still, umm, throws that out. On Tue, Dec 24, 2013 at 3:22 PM, bearophile wrote: > John Carter: > > > I'm storing the roman

Re: My first D module - Critiques welcome.

2013-12-23 Thread Brad Anderson
On Monday, 23 December 2013 at 21:34:34 UTC, John Carter wrote: So I resolved to learn D, and try code as idiomatically as I could. So here is a trivial module that encodes and decodes roman numerals. https://bitbucket.org/JohnCarter/roman/src/9ec5b36b9973426f35b0ab9dfd595cb3b305e39e/roman.d

Re: Suppressing UTFException / Squashing Bad Codepoints?

2013-12-23 Thread Jonathan M Davis
On Tuesday, December 24, 2013 02:06:22 Brad Anderson wrote: > On Monday, 23 December 2013 at 22:41:47 UTC, John Carter wrote: > > Eww. > > > > If I read the source correctly it mallocs a new array and runs > > down the > > original at least three times! (Four if you count peeks) > > > > Not to me

Re: "a[++i] = i" vs "a[i] = ++i"

2013-12-23 Thread David Held
On 12/23/2013 4:12 PM, Charles Hixson wrote: On 12/23/2013 12:39 PM, David Held wrote: [...] int mightUpdate(int& x) { ... return x; } { ... a[mightUpdate(i)] = mightUpdate(i); ... } Is this also a bug? How would the compiler know whether to emit a diagnostic for this case