Re: Another Phobos2 test

2011-02-08 Thread Adam D. Ruppe
bearophile: > I see. I prefer to see a chunk of code that does something, on the > screen, > and to not scroll too much. That's what functions are for! > I meant something different. I don't want to convert JSON tree > from-to text, I'd like to bypass the text representation fully. Yes, that wo

Re: Another Phobos2 test

2011-02-08 Thread spir
On 02/09/2011 01:35 AM, bearophile wrote: I meant something different. I don't want to convert JSON tree from-to text, I'd like to bypass the text representation fully. So the compile-time JSON Phobos library returns a data structure that represents the JSON tree (created by the compiler) in m

Re: Another Phobos2 test

2011-02-08 Thread spir
On 02/08/2011 10:11 PM, bearophile wrote: Adam Ruppe: I'm still trying to find something I like for this. Me too. I like Adam's solution as well, but it's not perfect. The only other solution (like for constraints) would be a syntactic difference, but since we're limited by keyboard keys,

Re: Another Phobos2 test

2011-02-08 Thread bearophile
Adam D. Ruppe: > I like it being thin so for me, it's a win/win. > I use small and split windows as well as > 8 character tab stops. (4 characters just blend into the background..) I see. I prefer to see a chunk of code that does something, on the screen, and to not scroll too much. For lot of t

Re: Another Phobos2 test

2011-02-08 Thread Adam D. Ruppe
bearophile: > I understand. But splitting lines too much make the code a bit > too much thin. I like it being thin so for me, it's a win/win. I use small and split windows as well as 8 character tab stops. (4 characters just blend into the background..) > I think a better solution is this request

Re: Another Phobos2 test

2011-02-08 Thread bearophile
Adam Ruppe: > I'm still trying to find something I like for this. Me too. > Error messages give a line number... but if there's still several > points of similar failure on that one line, it doesn't help as much > as it could. I understand. But splitting lines too much make the code a bit too

Re: Another Phobos2 test

2011-02-08 Thread spir
On 02/08/2011 04:11 PM, Adam Ruppe wrote: I know, but I was suggesting something different, to turn the JSON > creation into some kind of Phobos library that you may call at > compile-time from normal D code. Then a compile-time JSON reader in > Phobos will allow to perform certain kinds of st

Re: Another Phobos2 test

2011-02-08 Thread Adam Ruppe
bearophile: > This kind of indentations is interesting: I'm still trying to find something I like for this. Currently, I see the contracts as part of the public interface, just like the name, so I'm indenting them like I would if the argument list ran too long. void doSomethingBig( int arg1

Re: Another Phobos2 test

2011-02-08 Thread bearophile
Hamad: > == Quote from Adam Ruppe (destructiona...@gmail.com)'s article > > My implementation > > http://arsdnet.net/tictactoe.d > after your permtion i post your code in > http://rosettacode.org/wiki/Tic-tac-toe On Rosettacode they don't want too much long lines, so I suggest you to reduce ind

Re: Another Phobos2 test

2011-02-08 Thread Hamad
== Quote from Adam Ruppe (destructiona...@gmail.com)'s article > My implementation > http://arsdnet.net/tictactoe.d after your permtion i post your code in http://rosettacode.org/wiki/Tic-tac-toe

Re: Another Phobos2 test

2011-02-08 Thread bearophile
Adam Ruppe: > My implementation > http://arsdnet.net/tictactoe.d Thank you for your answers and code. Your code is better. This kind of indentations is interesting: string positionString(int pos) in { assert(...); } out(ret) { assert(...); } body { // ... }

Re: Another Phobos2 test

2011-02-07 Thread Adam Ruppe
My implementation http://arsdnet.net/tictactoe.d source: 138 lines, 2420 bytes You can see the byte count is comparable to the python 2, but I have more lines. This reflects my preferences of one line = one instruction. I usually prefer "Introduction to Programming" style code than "functional c

Re: Another Phobos2 test

2011-02-07 Thread Nick Sabalausky
"Jonathan M Davis" wrote in message news:mailman.1384.1297127779.4748.digitalmar...@puremagic.com... > > I don't even try and program in D like I would in C++. Neither would I. For instance, if I were about to do some coding in C++, I would begin by bashing my head into a brick wall. Sure, that

Re: Another Phobos2 test

2011-02-07 Thread Jonathan M Davis
On Monday, February 07, 2011 17:11:50 bearophile wrote: > Nick Sabalausky: > > (Although, I didn't read the OP very closely, so maybe I'm off-base.) > > They are right, I have done a "strategic" error. In the original post I > have mixed two kinds of very unrelated things: very small suggestions t

Re: Another Phobos2 test

2011-02-07 Thread Jonathan M Davis
On Monday, February 07, 2011 16:55:02 Andrew Wiley wrote: > On Mon, Feb 7, 2011 at 6:36 PM, bearophile wrote: > > Jonathan M Davis: > > > Regardless of what language you're > > > programming in, it's generally best to program in the typical paradigms > > > > of that > > > > > language. Trying to

Re: Another Phobos2 test

2011-02-07 Thread bearophile
Nick Sabalausky: > (Although, I didn't read the OP very closely, so maybe I'm off-base.) They are right, I have done a "strategic" error. In the original post I have mixed two kinds of very unrelated things: very small suggestions to improve (in my opinion) Phobos, plus some critiques to the D2

Re: Another Phobos2 test

2011-02-07 Thread Nick Sabalausky
"Nick Sabalausky" wrote in message news:iiq4pa$28aa$1...@digitalmars.com... > "Jonathan M Davis" wrote in message > news:mailman.1382.1297122691.4748.digitalmar...@puremagic.com... >> On Monday, February 07, 2011 15:34:26 bearophile wrote: >>> Adam Ruppe: >>> > My gut tells me you'd get much be

Re: Another Phobos2 test

2011-02-07 Thread Nick Sabalausky
"Jonathan M Davis" wrote in message news:mailman.1382.1297122691.4748.digitalmar...@puremagic.com... > On Monday, February 07, 2011 15:34:26 bearophile wrote: >> Adam Ruppe: >> > My gut tells me you'd get much better results if you tried to >> > write D in D instead of Python in D. >> >> That's r

Re: Another Phobos2 test

2011-02-07 Thread Andrew Wiley
On Mon, Feb 7, 2011 at 6:36 PM, bearophile wrote: > Jonathan M Davis: > > > Regardless of what language you're > > programming in, it's generally best to program in the typical paradigms > of that > > language. Trying to contort it to act like another language is _not_ > going to > > result in op

Re: Another Phobos2 test

2011-02-07 Thread bearophile
Jonathan M Davis: > Regardless of what language you're > programming in, it's generally best to program in the typical paradigms of > that > language. Trying to contort it to act like another language is _not_ going to > result in optimal code. D supports functional style too now. In Bugzilla

Re: Another Phobos2 test

2011-02-07 Thread Jonathan M Davis
On Monday, February 07, 2011 15:34:26 bearophile wrote: > Adam Ruppe: > > My gut tells me you'd get much better results if you tried to > > write D in D instead of Python in D. > > That's really beside the point. The point of the post is that there are > some spots where I'd like to see Phobos imp

Re: Another Phobos2 test

2011-02-07 Thread bearophile
Adam Ruppe: > My gut tells me you'd get much better results if you tried to > write D in D instead of Python in D. That's really beside the point. The point of the post is that there are some spots where I'd like to see Phobos improved. (And I am willing to write part of the Phobos code I am as

Re: Another Phobos2 test

2011-02-07 Thread Adam Ruppe
My gut tells me you'd get much better results if you tried to write D in D instead of Python in D. I might take a stab at this myself. I can see lots of improvements to the original code.

Another Phobos2 test

2011-02-07 Thread bearophile
I've found another taks in the rosettacode.org site: http://rosettacode.org/wiki/Tic-tac-toe The program itself is not so interesting, and probably there are better ways to implement a Tic-tac-toe player program. But it's a good enough example to test Phobos2, to see how much handy it is when yo