Re: D is back on Tiobe, now in position 23

2011-05-21 Thread Russel Winder
On Fri, 2011-05-20 at 22:19 +0100, Robert Clipsham wrote:
[ . . . ]
 And yes, I know TIOBE is a completely useless index (read that as a list 
 of sophisticated arguments you've read before about it rather than a 
 single sentence :3)

I disagree that it is useless.  It is interesting on two grounds:

1.  If you have any sort of idea about what they are actually measuring
and are careful no to over-infer, it is a very interesting measure of
what is interesting to people in the Web-verse.  It is a measure of
buzz.

2.  It is interesting to see how people who have no idea of what is
actually being measured use the results for decision making.  There is
an interesting ebb and flow between reinforcement of the status quo and
promoting innovation.  Also there is the ability to manipulate the
system as Go did last year. 

Obviously though there are dangers . . .
-- 
Russel.
=
Dr Russel Winder  t: +44 20 7585 2200   voip: sip:russel.win...@ekiga.net
41 Buckmaster Roadm: +44 7770 465 077   xmpp: rus...@russel.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: There's new GIT instructions on Github now

2011-05-21 Thread Russel Winder
On Fri, 2011-05-20 at 22:42 +0200, Daniel Gibson wrote:
[ . . . ]
 Microsofts VCS (Visual Sourcesafe or something like that) won't work
 properly on Linux either..

Visual SourceSafe doesn't work on Windows either.

-- 
Russel.
=
Dr Russel Winder  t: +44 20 7585 2200   voip: sip:russel.win...@ekiga.net
41 Buckmaster Roadm: +44 7770 465 077   xmpp: rus...@russel.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: There's new GIT instructions on Github now

2011-05-21 Thread Russel Winder
On Fri, 2011-05-20 at 23:19 +0200, Daniel Gibson wrote:
 Am 20.05.2011 23:17, schrieb Robert Clipsham:
  On 20/05/2011 21:42, Daniel Gibson wrote:
  Microsofts VCS (Visual Sourcesafe or something like that) won't work
  properly on Linux either..
  
  I wouldn't really compare Visual Sourcesafe to git... It barely
  qualifies as a version control system :3
 
 I think MS doesn't have anything that comes closer to a VCS, so there
 was nothing else I could have used that comparison ;)

Not entirely true, they have Team Foundation Server (including Team
Foundation Version Control) which is reputed to work reasonably well,
especially with Visual Studio.  On the other hand I have no first hand
experience as it requires Windows Server, IIS, and SharePoint.

-- 
Russel.
=
Dr Russel Winder  t: +44 20 7585 2200   voip: sip:russel.win...@ekiga.net
41 Buckmaster Roadm: +44 7770 465 077   xmpp: rus...@russel.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: There's new GIT instructions on Github now

2011-05-21 Thread Nick Sabalausky
Russel Winder rus...@russel.org.uk wrote in message 
news:mailman.301.1305958019.14074.digitalmar...@puremagic.com...
On Fri, 2011-05-20 at 22:42 +0200, Daniel Gibson wrote:
[ . . . ]
 Microsofts VCS (Visual Sourcesafe or something like that) won't work
 properly on Linux either..

Visual SourceSafe doesn't work on Windows either.


Well, I don't know about that, now. Let's not be too hasty... After all, are 
we really *certain* what the primary purpose of VSS is? Sure we all *assume* 
it's a VCS. But if it's really a tool to piss of programmers and make them 
prematurely grow grey hair, then I'd say it works fantastically!




Re: D is back on Tiobe, now in position 23

2011-05-21 Thread Matthias Pleh

Am 21.05.2011 08:02, schrieb Russel Winder:

On Fri, 2011-05-20 at 22:19 +0100, Robert Clipsham wrote:
[ . . . ]

And yes, I know TIOBE is a completely useless index (read that as a list
of sophisticated arguments you've read before about it rather than a
single sentence :3)


I disagree that it is useless.  It is interesting on two grounds:

1.  If you have any sort of idea about what they are actually measuring
and are careful no to over-infer, it is a very interesting measure of
what is interesting to people in the Web-verse.  It is a measure of
buzz.

2.  It is interesting to see how people who have no idea of what is
actually being measured use the results for decision making.  There is
an interesting ebb and flow between reinforcement of the status quo and
promoting innovation.  Also there is the ability to manipulate the
system as Go did last year.

Obviously though there are dangers . . .


quote
The first 100 pages per search engine are checked for possible false 
positives and this is used to define the confidence factor.

/quote

http://www.tiobe.com/index.php/content/paperinf/tpci/tpci_definition.htm


'd programming' gives ca. 81.300.300 results on google ...

_
Matthias


Re: D is back on Tiobe, now in position 23

2011-05-21 Thread Walter Bright

On 5/20/2011 2:18 PM, Robert Clipsham wrote:

On 20/05/2011 21:39, Andrei Alexandrescu wrote:

On 5/20/11 3:35 PM, Andrei Alexandrescu wrote:

http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html

Andrei


Oh wait, it was only missing from the shootout, not the index... no?

Andrei


Correct. When I started with D a few years ago it was just missing the top 10 on
TIOBE ;



It dropped when Tiobe changed the way they counted hits.


Re: There's new GIT instructions on Github now

2011-05-21 Thread Walter Bright

On 5/20/2011 7:52 AM, Don wrote:

Sorry, but your reply is a textbook example of fanboyism. On Windows, git is an
utterly lousy product. And yes, I have both cygwin and Msys.


Reminds me of when I tried to run Latex on Windows. What a disaster.

Also, git just doesn't work right with files that end in CRLF. I fought this for 
a while, and finally gave up. Everything I check in I run through a converter 
which strips out the CR. No more troubles.




Re: There's new GIT instructions on Github now

2011-05-21 Thread Walter Bright

On 5/20/2011 3:05 PM, Andrej Mitrovic wrote:

I would also like to know how to uncommit a change which hasn't been
pushed yet. So if I locally do:
git add someFile.d
git commit -m woops wrong comment

I'd like to just uncommit that message. I couldn't find an easy way to
do this.


What I do is rm -rf the entire project directory, then re-clone it from github. 
Voila!


(Yes, I suck at git. But I like it anyway.)


Re: [OT] Re: There's new GIT instructions on Github now

2011-05-21 Thread Walter Bright

On 5/20/2011 10:12 AM, Andrei Alexandrescu wrote:

So it's not surprising that git/Windows has many issues, just
the same it's not surprising that people are having trouble playing media or
using OpenOffice on Unixen.


I gave up again on using Unix to play music. I got tired of continually having 
to reboot the machine to get it unhung.


There is one exceptional program - Thunderbird email. It works great on Windows, 
OS X and Linux. No issues.


Re: There's new GIT instructions on Github now

2011-05-21 Thread Walter Bright

On 5/20/2011 11:06 PM, Russel Winder wrote:

On Fri, 2011-05-20 at 22:42 +0200, Daniel Gibson wrote:
[ . . . ]

Microsofts VCS (Visual Sourcesafe or something like that) won't work
properly on Linux either..


Visual SourceSafe doesn't work on Windows either.



Ouch!



Re: There's new GIT instructions on Github now

2011-05-21 Thread Don

Jesse Phillips wrote:

Don Wrote:

No, fanboyism is evidenced in dismissing a list of bugs. I think that 
was a darn good list.
 
Based on what you have described it sounds like most of your problems come with using poorly ported Linux programs and not with the Windows port of Git.


You had symbolic links and mounted files, those don't exist in Windows. 
Junctions exist for NTFS, but I doubt that is what you refer.


They're not symbolic links. Just junctions.
They're the only vaguely unusual thing on my machine.
I've never had any similar problem with anything other than git.


I happily run git in powershell with assistance from gvim.


Re: There's new GIT instructions on Github now

2011-05-21 Thread Vladimir Panteleev

On Sat, 21 May 2011 11:31:06 +0300, Don nos...@nospam.com wrote:


Jesse Phillips wrote:

Don Wrote:

No, fanboyism is evidenced in dismissing a list of bugs. I think that  
was a darn good list.
 Based on what you have described it sounds like most of your problems  
come with using poorly ported Linux programs and not with the Windows  
port of Git.
 You had symbolic links and mounted files, those don't exist in  
Windows. Junctions exist for NTFS, but I doubt that is what you refer.


They're not symbolic links. Just junctions.
They're the only vaguely unusual thing on my machine.
I've never had any similar problem with anything other than git.


I use junctions a lot. I never had such problems with them. Your problems  
originate elsewhere.


--
Best regards,
 Vladimirmailto:vladi...@thecybershadow.net


Re: There's new GIT instructions on Github now

2011-05-21 Thread Don

David Nadlinger wrote:

On 5/20/11 11:47 PM, Don wrote:

Still not fixed in cygwin in 2011.
So, just to make this clear, you are using Git via Cygwin instead of 
msysgit (which is pretty much the default for Git on Windows these days)?



No, fanboyism is evidenced in dismissing a list of bugs. I think that
was a darn good list.
Honestly, I hardly think so, given that half of the items arent't even 
bugs…


David


Which ones aren't bugs? Yes, there's one which is just a poorly written 
man page (that's my opinion, and is debatable). Do you think any of the 
others aren't valid bugzilla entries?


Re: [OT] Re: There's new GIT instructions on Github now

2011-05-21 Thread Vladimir Panteleev

On Sat, 21 May 2011 08:12:24 +0300, Nick Sabalausky a@a.a wrote:


My experience has been the other way around. Besides, a *lot* of windows
programmers don't use Visual Studio. I don't. (Used to, back around  
versions

5-6 and early .NET, but not anymore.)


I frequently hear that Visual Studio is the all-round best IDE for C/C++  
development (I rarely use it myself, so I don't have an opinion). I  
suppose that's the power of dogfooding...


--
Best regards,
 Vladimirmailto:vladi...@thecybershadow.net


Re: [OT] Re: There's new GIT instructions on Github now

2011-05-21 Thread Russel Winder
On Sat, 2011-05-21 at 01:23 -0700, Walter Bright wrote:
[ . . . ]
 
 I gave up again on using Unix to play music. I got tired of continually 
 having 
 to reboot the machine to get it unhung.

Music plays just fine on Linux.  It also plays fine on Apple's brand of
Unix.  I haven't tried on Solaris recently.

[ . . . ]

-- 
Russel.
=
Dr Russel Winder  t: +44 20 7585 2200   voip: sip:russel.win...@ekiga.net
41 Buckmaster Roadm: +44 7770 465 077   xmpp: rus...@russel.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: There's new GIT instructions on Github now

2011-05-21 Thread Vladimir Panteleev
On Sat, 21 May 2011 01:05:56 +0300, Andrej Mitrovic  
andrej.mitrov...@gmail.com wrote:



I would also like to know how to uncommit a change which hasn't been
pushed yet. So if I locally do:
git add someFile.d
git commit -m woops wrong comment

I'd like to just uncommit that message. I couldn't find an easy way to
do this.


git reset HEAD^

If you just want to edit the commit message of your last commit, use:

git commit -am New message


Isn't this just hg revert on mercurial? I had to resort to
backing up the files and re-fetching from the repo because git kept
complaining about being ahead of changes. Damn complicated software
that needs a book to operate it. :]

Also I'd add the first time I tried using GIT GUI a few months ago it
froze and crashed when I tried to do a simple clone.


I don't use git gui for cloning/pushing/etc., but it's really nice for  
reviewing and picking out your changes before committing.


--
Best regards,
 Vladimirmailto:vladi...@thecybershadow.net


Re: allowing zero-argument runtime-only struct constructors

2011-05-21 Thread kenji hara
Some days ago, I created patch, and posted pull request #72.
http://d.puremagic.com/issues/show_bug.cgi?id=6036
https://github.com/D-Programming-Language/dmd/pull/72

This patch fixes some opCall problem, and allow a zero-argument
default constructor on stack allocation, even exists multiple-argument
explicit constructors.

        // Calls zero-argument constructor function,
        // due to parentheses after type.
        // Compile-time error if no zero-argument constructor defined.
        MyStruct ms3 = MyStruct();
This will be passing compilation with my patch (unless zero-argument
static opCall is defined).

        // Calls zero-argument constructor function,
        // due to parentheses after type.
        // Compile-time error if no zero-argument constructor defined.
        // This behavior CANNOT BE GOTTEN with new and opCall in current
        // versions of D to my knowledge.
        MyStruct *ms4 = new MyStruct();
Unfortunately, my patch doesn't fix this behavior.
Please post a new report into bugzilla with test cases.

Kenji Hara


Should binary sharing be done using Mixin Template?

2011-05-21 Thread Matthew Ong

Hi D Developer/Walter Bright,

Coming from a VM environment.

Should D be able to do binary sharing when the same template is being 
used for different data type.


In java using template, the same LinkedList binary is shared for both 
String class type and also Integer class type.


LinkedListString list=new LinkedListString();
LinkedListInteger list=new LinkedListInteger();

// Can also apply for Account/Order/PO...
LinkedListAccount list=new LinkedListAccount();

But there is a single LinkedList Class File(single binary).

Perhaps that is possible via some sort of binary plumbing internal to 
the compiler? I believe the wrapper is just to ensure the Object type 
handling casting concern. I might be wrong.


Accoding to Jonathan Davis,

There is no linking involved in mixins. It's not shared.

This approach I believe allow the final output be smaller even and 
pushes the D to be closer even to the dynamic ability of VM but without 
the extra over head.


Can someone really say why this is a bad bad idea for memory with some 
automated plumbing being done like in ActiveX/Com/DCOM.



--
Matthew Ong
email: on...@yahoo.com



Re: There's new GIT instructions on Github now

2011-05-21 Thread Don

Vladimir Panteleev wrote:

On Sat, 21 May 2011 00:47:46 +0300, Don nos...@nospam.com wrote:

Yeah, I would have thought so. I wouldn't expect to find the root 
cause first described as bug #21, yes TWENTY ONE in the msysgit database.


Sorry, but did you read the bug report and the whole comment you linked 
to? It's completely unrelated, core.auto-crlf is related to the 
conversion of files in the working directory - this setting will not 
affect the way the index is accessed. You're not making much of sense,

and I'm the fanboy here...

I don't know exactly what causes it. It may have something to do with 
the fact that I have a symlink in my path. Here's the result of a 
quick google:


http://www.nishioka.com/blog/2008/01/source-control-with-git-and-cygwin.html 



If you use git on cygwin, you must be sure your disks are mounted 
binmode or your database will get corrupted!


I had all my disks but one mounted binmode, but I also had a symbolic 
link that ended up using that one textmode mount. This corrupted the 
index and I got:


error: bad index file sha1 signature
fatal: index file corrupt

Still not fixed in cygwin in 2011.


How did you end up with a text mount? Did you create it yourself?


I don't even know what a text mount is.  (That's a quote from the page).
But my symptoms seem exactly the same as that.

My experience is:
* download, standard install.
* As far as I know there is nothing unusual to my Windows setup.
* Running 'git status' corrupts the database.
* Googling for the error message I find other people have encountered 
this before.

* I find many other bugs within a couple of hours of use.
Conclude this is an _extremely_ immature product.

I'm amazed anyone disagrees with that.




Re: Should binary sharing be done using Mixin Template?

2011-05-21 Thread Vladimir Panteleev

On Sat, 21 May 2011 12:26:35 +0300, Matthew Ong on...@yahoo.com wrote:

Should D be able to do binary sharing when the same template is being  
used for different data type.


A linker should be able to merge binary-identical objects in read-only  
segments, but this will cause ambiguity in stack traces (and possibly have  
other consequences I can't think of).


--
Best regards,
 Vladimirmailto:vladi...@thecybershadow.net


Re: There's new GIT instructions on Github now

2011-05-21 Thread David Nadlinger

On 5/21/11 12:05 AM, Andrej Mitrovic wrote:

I would also like to know how to uncommit a change which hasn't been
pushed yet. So if I locally do:
git add someFile.d
git commit -m woops wrong comment


If you just want to modify the commit, e.g. because you made a typo in 
the message, forgot some files, etc., use »git commit --amend«:


git add someFilePreviouslyLeftOut.d
git commit --amend …

(This will obviously change an existing commit, don't do it if you have 
already pushed your changes somewhere else.)



To, entirely remove the, say, two last commits from history, but not 
modify the contents of the files in your working tree, use »git reset«:


git reset HEAD~2 (or HEAD^ for just one commit)



I'd like to just uncommit that message. I couldn't find an easy way to
do this. Isn't this just hg revert on mercurial?


Nope, hg revert checks out individual files from a recorded changeset 
(usually the last), much like »git checkout some/file«. If you want to 
remove the last two commits like above, say r1001 and 1002, you have to 
do something like this:


hg update -r1000
hg revert -all -r1002
hg strip --force 1001


David


Re: Struct beeing moved around

2011-05-21 Thread Benjamin Thaut

Am 20.05.2011 22:57, schrieb Michel Fortin:

On 2011-05-20 14:46:03 -0400, Benjamin Thaut c...@benjamin-thaut.de said:


Am 20.05.2011 19:51, schrieb Michel Fortin:

On 2011-05-20 13:36:58 -0400, Benjamin Thaut c...@benjamin-thaut.de
said:


What if I need a value type that may be copied, but may not be moved?


I don't think that's possible. Why would you want that?


[...]

If there is no garantuee that a struct stays on the same memory
location within 1 Stack frame, you pretty much can not implement a
other GC unless you hack into the compiler.


But... is that a real problem or just something you've come up with to
argue that a move constructor can be useful? I ask because it looks
pretty synthetic: if you're going to call something alike
GC.addRoot/GC.removeRoot upon construction and destruction of this smart
pointer you could as well implement standard reference counting. And
reference counting does not need a move constructor since moving doesn't
change the reference count.

But this is an interesting topic. I'm currently hacking the compiler to
support Objective-C objects. As part of this I want the memory to be
managed automatically, which isn't so easy because Objective-C objects
have to live in a separate heap. So I'll need to add support for an
external memory management system and make it work seamlessly with the D
GC. I already know how I'm going to implement it, and it won't require
anything like a move constructor.

This is acutally a real problem. I'm currently implementing a Baker GC 
for the Lisp VM I'm implementing in D 2.0. A Baker GC needs to know 
exactly where the pointers are located, because it needs to change the 
pointers during collection. I'm only doing the GC.addRoot/GC.removeRoot 
for refernces that are allocated on that Stack. Not for every reference. 
And reference couting is not sufficient, because it does not break 
cycles. As the GC needs to change the pointers, I would need a move 
constructor, so I can update the pointers memory location.


I'm curious, are there plans that D is going to use something that is 
not a Mark  Sweep?

--
Kind Regards
Benjamin Thaut


Re: Should binary sharing be done using Mixin Template?

2011-05-21 Thread Daniel Gibson

Am 21.05.2011 11:26, schrieb Matthew Ong:

Hi D Developer/Walter Bright,

Coming from a VM environment.

Should D be able to do binary sharing when the same template is being
used for different data type.

In java using template, the same LinkedList binary is shared for both
String class type and also Integer class type.

LinkedListString list=new LinkedListString();
LinkedListInteger list=new LinkedListInteger();

// Can also apply for Account/Order/PO...
LinkedListAccount list=new LinkedListAccount();

But there is a single LinkedList Class File(single binary).



This is because Javas generics are gone when the code is compiled, i.e. 
ListInteger und ListString is the same type.

I find them rather useless, you can't overload from Generics parameters:
  void foo(ListInteger l) { ... }
  void foo(ListString l) { ...  }
won't compile.
Totally different from D or C++ where a new type is created that is 
actually specific to the template parameter.



Perhaps that is possible via some sort of binary plumbing internal to
the compiler? I believe the wrapper is just to ensure the Object type
handling casting concern. I might be wrong.



In D you can have non class types as template parameters.
And even with class types your code could handle different classes in a 
different way via static if( is(T : MyType) ) { ... } etc



Accoding to Jonathan Davis,

 There is no linking involved in mixins. It's not shared.

This approach I believe allow the final output be smaller even and
pushes the D to be closer even to the dynamic ability of VM but without
the extra over head.

Can someone really say why this is a bad bad idea for memory with some
automated plumbing being done like in ActiveX/Com/DCOM.






Re: There's new GIT instructions on Github now

2011-05-21 Thread Vladimir Panteleev

On Sat, 21 May 2011 12:28:04 +0300, Don nos...@nospam.com wrote:


 How did you end up with a text mount? Did you create it yourself?


I don't even know what a text mount is.  (That's a quote from the page).
But my symptoms seem exactly the same as that.

My experience is:
* download, standard install.
* As far as I know there is nothing unusual to my Windows setup.
* Running 'git status' corrupts the database.
* Googling for the error message I find other people have encountered  
this before.

* I find many other bugs within a couple of hours of use.
Conclude this is an _extremely_ immature product.

I'm amazed anyone disagrees with that.


Well, there you have the main point of our argument: your experience with  
Git on Windows was indeed awful, but why should someone (the overwhelming  
majority?) who never encountered these problems agree with you?


All I'm saying is that you are presenting the conclusions based on your  
personal experience as an objective truth. Git may appear to be an  
_extremely_ immature product when used on a system and in a manner  
similar to yours, but you can't say that about everyone.


Have you had a chance to try DustMite yet? I was looking for the  
std.datetime problem you referred to in the D.learn post, but couldn't  
find it.


--
Best regards,
 Vladimirmailto:vladi...@thecybershadow.net


Re: [OT] Re: There's new GIT instructions on Github now

2011-05-21 Thread Daniel Gibson

Am 21.05.2011 07:12, schrieb Nick Sabalausky:

Daniel Gibsonmetalcae...@gmail.com  wrote in message
news:ir6tel$1he8$1...@digitalmars.com...

Am 21.05.2011 01:18, schrieb Nick Sabalausky:

David Nadlingers...@klickverbot.at  wrote in message
news:ir6r72$l38$1...@digitalmars.com...

On 5/21/11 12:34 AM, Nick Sabalausky wrote:

And again, using Wine doesn't count as supporting Linux, so why the
hell
should the other way around be any different?


Because, at least in my eyes, there is a huge difference between telling
your users that using Wine they might be able to get your software to
work
on Linux (which is typically the most you can hope for if you are a
Linux
user), and using MinGW to make porting your application to Windows
easier,
which is not necessarily visible to the end user.



OSS programs, which most Linux programs are, are expected to be
compilable
by the user. Therefore, if msys or mingw are required to build it, then
it
*is* visible to the end user.


Compiling on Windows always sucks and is generally not done by the end
*user* (who generally is not a coder).
And I think it's easier for the user to install MinGW and MSYS and run
make than installing and configuring Visual Studio (especially when the
project is for another, maybe older, version) and use that for compiling.



My experience has been the other way around. Besides, a *lot* of windows
programmers don't use Visual Studio. I don't. (Used to, back around versions
5-6 and early .NET, but not anymore.)



So how do you compile C/C++ code on windows? DMC? Fine for your code but 
I guess most open source projects don't support it.

Dev-C++, Eclpse CDT, ...? AFAIK they use the mingw compiler :P


And with D, compiling is equally easy/hard on both Windows/Linux :)



If the projects uses GNU makefiles (which is quite common on Linux) you 
need MSYS or something like that to compile it on Windows.


Re: There's new GIT instructions on Github now

2011-05-21 Thread Daniel Gibson

Am 21.05.2011 08:15, schrieb Russel Winder:

On Fri, 2011-05-20 at 23:19 +0200, Daniel Gibson wrote:

Am 20.05.2011 23:17, schrieb Robert Clipsham:

On 20/05/2011 21:42, Daniel Gibson wrote:

Microsofts VCS (Visual Sourcesafe or something like that) won't work
properly on Linux either..


I wouldn't really compare Visual Sourcesafe to git... It barely
qualifies as a version control system :3


I think MS doesn't have anything that comes closer to a VCS, so there
was nothing else I could have used that comparison ;)


Not entirely true, they have Team Foundation Server (including Team
Foundation Version Control) which is reputed to work reasonably well,
especially with Visual Studio.  On the other hand I have no first hand
experience as it requires Windows Server, IIS, and SharePoint.



OK, I'm not really familiar with Microsoft tools.
I guess MS doesn't provide a Linux client for that either. ;)


Re: There's new GIT instructions on Github now

2011-05-21 Thread Daniel Gibson

Am 21.05.2011 11:28, schrieb Don:

Vladimir Panteleev wrote:

On Sat, 21 May 2011 00:47:46 +0300, Don nos...@nospam.com wrote:


Yeah, I would have thought so. I wouldn't expect to find the root
cause first described as bug #21, yes TWENTY ONE in the msysgit
database.


Sorry, but did you read the bug report and the whole comment you
linked to? It's completely unrelated, core.auto-crlf is related to the
conversion of files in the working directory - this setting will not
affect the way the index is accessed. You're not making much of sense,
and I'm the fanboy here...


I don't know exactly what causes it. It may have something to do with
the fact that I have a symlink in my path. Here's the result of a
quick google:

http://www.nishioka.com/blog/2008/01/source-control-with-git-and-cygwin.html


If you use git on cygwin, you must be sure your disks are mounted
binmode or your database will get corrupted!

I had all my disks but one mounted binmode, but I also had a symbolic
link that ended up using that one textmode mount. This corrupted the
index and I got:

error: bad index file sha1 signature
fatal: index file corrupt

Still not fixed in cygwin in 2011.


How did you end up with a text mount? Did you create it yourself?


I don't even know what a text mount is. (That's a quote from the page).
But my symptoms seem exactly the same as that.

My experience is:
* download, standard install.
* As far as I know there is nothing unusual to my Windows setup.
* Running 'git status' corrupts the database.
* Googling for the error message I find other people have encountered
this before.
* I find many other bugs within a couple of hours of use.
Conclude this is an _extremely_ immature product.

I'm amazed anyone disagrees with that.




By the way: Have you ever tried JGIT? http://www.eclipse.org/jgit/
I don't know how mature it is, but at least it doesn't seem to rely on 
bash scripts and such.


Cheers,
- Daniel


Re: Should binary sharing be done using Mixin Template?

2011-05-21 Thread Jonathan M Davis
On 2011-05-21 02:26, Matthew Ong wrote:
 Hi D Developer/Walter Bright,
 
 Coming from a VM environment.
 
 Should D be able to do binary sharing when the same template is being
 used for different data type.
 
 In java using template, the same LinkedList binary is shared for both
 String class type and also Integer class type.
 
 LinkedListString list=new LinkedListString();
 LinkedListInteger list=new LinkedListInteger();
 
 // Can also apply for Account/Order/PO...
 LinkedListAccount list=new LinkedListAccount();
 
 But there is a single LinkedList Class File(single binary).
 
 Perhaps that is possible via some sort of binary plumbing internal to
 the compiler? I believe the wrapper is just to ensure the Object type
 handling casting concern. I might be wrong.
 
 Accoding to Jonathan Davis,
 
  There is no linking involved in mixins. It's not shared.
 
 This approach I believe allow the final output be smaller even and
 pushes the D to be closer even to the dynamic ability of VM but without
 the extra over head.
 
 Can someone really say why this is a bad bad idea for memory with some
 automated plumbing being done like in ActiveX/Com/DCOM.

If you want to have containers be shared, then just put Objects in them and 
cast them to the correct type when you get them out. That's what Java does. 
It's just that starting with Java 1.5, the generics do it for you.

Templates are completely different from generics. Generics are compile-time 
artifacts only and have no effect on the final binary. Templates, on the other 
hand, are generated for each type that they're instantiated with. They are 
code generation, pure and simple. And since each and every instantiation could 
be very different depending on what was done with static if and other compile-
time stuff which can affect code generation. So, if you had a 
LinkedListAccount and a LinkedListstring, their internal implementation 
could be completely different if the writer of LinkedList thought that it was 
appropriate to do so for whatever reason. In the general case, templates are 
not at all combinable. Even if two template instantiations generate 
effectively the same code, unless the're binary compatible, you can't possibly 
combine them. Now, as I understand it, gcc does do some template combining in 
C++ where it can, but that's an advanced optimization technique that not all 
C++ compilers do, and I don't believe that any D compilers do it at present.

Templates and generics are completely different. They both have their 
advantages and disadvantages, but please don't try and make templates act like 
generics. It's just not going to work. They are inherently different 
regardless of how similar their syntax might be.

- Jonathan M Davis


Re: [OT] Re: There's new GIT instructions on Github now

2011-05-21 Thread Lutger Blijdestijn
Daniel Gibson wrote:

 Am 21.05.2011 01:34, schrieb Andrej Mitrovic:
 What's there to configuring visual studio? You just open a solution
 file and hit compile. If there are any dependencies you usually
 download the libs and put them in some subfolder.
 
 
 I don't have much experience with visual studio, but I've read that
 using a project from one version in another (newer) version may not
 always be painless, e.g.
 http://twitter.com/#!/ID_AA_Carmack/status/45616436995039232

Going from one version of a *solution* to the next usually just works. I 
expect tech5 to be somewhat more complex though. What usually doesn't work 
is going from one compiler version to the next, at least for C++. 'Managed' 
.Net is a different story.
 
 And how well do projects from a professional version work in the free
 (Visual Studio Express) version?

That should work, the professional version is mostly about extra ide 
features, the basics and the toolchain is exactly the same.
 
 At least that's my experience.
 
 Now compare that to having to follow that gigantic tutorial for
 compiling GDC using msys.

That's not really a fair comparison, GDC is very complex. There are also a 
lot of OSS projects which are much less arcane than what GNU usually does. 
Windows has it's share of complex build setups too, I believe the visual 
studio shell is such an example. I generally also find the boatloads of 
msbuild / nant xml scripts to be pretty incomprehensible when you need to 
work with them if something doesn't work. 


Re: There's new GIT instructions on Github now

2011-05-21 Thread Russel Winder
On Sat, 2011-05-21 at 12:00 +0200, Daniel Gibson wrote:
 Am 21.05.2011 08:15, schrieb Russel Winder:
  On Fri, 2011-05-20 at 23:19 +0200, Daniel Gibson wrote:
  Am 20.05.2011 23:17, schrieb Robert Clipsham:
  On 20/05/2011 21:42, Daniel Gibson wrote:
  Microsofts VCS (Visual Sourcesafe or something like that) won't work
  properly on Linux either..
 
  I wouldn't really compare Visual Sourcesafe to git... It barely
  qualifies as a version control system :3
 
  I think MS doesn't have anything that comes closer to a VCS, so there
  was nothing else I could have used that comparison ;)
 
  Not entirely true, they have Team Foundation Server (including Team
  Foundation Version Control) which is reputed to work reasonably well,
  especially with Visual Studio.  On the other hand I have no first hand
  experience as it requires Windows Server, IIS, and SharePoint.
 
 
 OK, I'm not really familiar with Microsoft tools.
 I guess MS doesn't provide a Linux client for that either. ;)

Definitely not -- after all why would Microsoft even contemplate that
you were going to buy anything other than Microsoft product -- but there
are various plug-ins for Eclipse, IntelliJ IDEA, etc. to allow them to
make checkouts of TFS hosted repositories.  It's just web services so no
big deal.  Though the conspiracy theorists will undoubtedly want to
worry about all the hidden checks etc. to hobble non-Microsoft products.

Personally I'll just stick with Bazaar, Mercurial and Git.

-- 
Russel.
=
Dr Russel Winder  t: +44 20 7585 2200   voip: sip:russel.win...@ekiga.net
41 Buckmaster Roadm: +44 7770 465 077   xmpp: rus...@russel.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: There's new GIT instructions on Github now

2011-05-21 Thread Lutger Blijdestijn
Andrej Mitrovic wrote:

 Also I'd add the first time I tried using GIT GUI a few months ago it
 froze and crashed when I tried to do a simple clone.

I like git cola for gui. I has some nice features such as picking the lines 
from a file you want to stage for a commit.

http://cola.tuxfamily.org/



Re: There's new GIT instructions on Github now

2011-05-21 Thread Daniel Gibson

Am 21.05.2011 13:13, schrieb Russel Winder:

On Sat, 2011-05-21 at 12:00 +0200, Daniel Gibson wrote:

Am 21.05.2011 08:15, schrieb Russel Winder:

On Fri, 2011-05-20 at 23:19 +0200, Daniel Gibson wrote:

Am 20.05.2011 23:17, schrieb Robert Clipsham:

On 20/05/2011 21:42, Daniel Gibson wrote:

Microsofts VCS (Visual Sourcesafe or something like that) won't work
properly on Linux either..


I wouldn't really compare Visual Sourcesafe to git... It barely
qualifies as a version control system :3


I think MS doesn't have anything that comes closer to a VCS, so there
was nothing else I could have used that comparison ;)


Not entirely true, they have Team Foundation Server (including Team
Foundation Version Control) which is reputed to work reasonably well,
especially with Visual Studio.  On the other hand I have no first hand
experience as it requires Windows Server, IIS, and SharePoint.



OK, I'm not really familiar with Microsoft tools.
I guess MS doesn't provide a Linux client for that either. ;)


Definitely not -- after all why would Microsoft even contemplate that
you were going to buy anything other than Microsoft product


that's about my point about git and windows ;)


-- but there
are various plug-ins for Eclipse, IntelliJ IDEA, etc. to allow them to
make checkouts of TFS hosted repositories.


Could be similar for git. In fact JGIT exists and eclipse and netbeans 
plugins that use JGIT.



It's just web services so no
big deal.  Though the conspiracy theorists will undoubtedly want to
worry about all the hidden checks etc. to hobble non-Microsoft products.

Personally I'll just stick with Bazaar, Mercurial and Git.





Re: [OT] Re: There's new GIT instructions on Github now

2011-05-21 Thread Daniel Gibson

Am 21.05.2011 13:09, schrieb Lutger Blijdestijn:

Daniel Gibson wrote:


Am 21.05.2011 01:34, schrieb Andrej Mitrovic:

What's there to configuring visual studio? You just open a solution
file and hit compile. If there are any dependencies you usually
download the libs and put them in some subfolder.



I don't have much experience with visual studio, but I've read that
using a project from one version in another (newer) version may not
always be painless, e.g.
http://twitter.com/#!/ID_AA_Carmack/status/45616436995039232


Going from one version of a *solution* to the next usually just works. I
expect tech5 to be somewhat more complex though. What usually doesn't work
is going from one compiler version to the next, at least for C++.


Probably that was the problem.
So this seems to be a general problem: You can't just import and build a 
C++ project of VSC version X in you VSC version Y - and fixing the code 
to make compile errors go away is not something the end user will want 
to do.
But of course this problem also exists with different versions of 
g++/MinGW. It should be possible to install multiple versions of MinGW's 
gcc/g++ in parallel though.



'Managed'
.Net is a different story.


And how well do projects from a professional version work in the free
(Visual Studio Express) version?


That should work, the professional version is mostly about extra ide
features, the basics and the toolchain is exactly the same.



hmm Robert said it didn't work for him.


At least that's my experience.

Now compare that to having to follow that gigantic tutorial for
compiling GDC using msys.


That's not really a fair comparison, GDC is very complex. There are also a
lot of OSS projects which are much less arcane than what GNU usually does.
Windows has it's share of complex build setups too, I believe the visual
studio shell is such an example. I generally also find the boatloads of
msbuild / nant xml scripts to be pretty incomprehensible when you need to
work with them if something doesn't work.


I agree.


Re: There's new GIT instructions on Github now

2011-05-21 Thread Vladimir Panteleev
On Sat, 21 May 2011 14:14:18 +0300, Lutger Blijdestijn  
lutger.blijdest...@gmail.com wrote:



Andrej Mitrovic wrote:


Also I'd add the first time I tried using GIT GUI a few months ago it
froze and crashed when I tried to do a simple clone.


I like git cola for gui. I has some nice features such as picking the  
lines

from a file you want to stage for a commit.


git gui can do that too (right-click on a line, select stage line for  
commit).


A nice thing that git cola can do that git gui can't, is revert changes  
line-by-line, so you can easily throw away some unintentional or test  
changes.


--
Best regards,
 Vladimirmailto:vladi...@thecybershadow.net


Re: [OT] Re: There's new GIT instructions on Github now

2011-05-21 Thread David Nadlinger

On 5/21/11 1:09 PM, Lutger Blijdestijn wrote:

And how well do projects from a professional version work in the free
(Visual Studio Express) version?


That should work, the professional version is mostly about extra ide
features, the basics and the toolchain is exactly the same.


I have encountered quite a few problems though. For example, 64 bit code 
generation used to be absent by default from Express versions (maybe it 
still is, haven't checked), which is a sensible marketing decision per 
se. However, it was implemented in such a way that I couldn't open a 
solution file from an open source project I was working on with my 
Express edition installation, just because it contained an x64 target…


David


Re: There's new GIT instructions on Github now

2011-05-21 Thread Lutger Blijdestijn
Andrej Mitrovic wrote:

 What the duck has happened to this topic?
 
 Ok anyway, I found out a few things:
 
 I can change $HOME by adding this line into C:\Program
 Files\Git\etc\profile file:
 HOME=/d/dev/git/
 
 right *above* this line:
 HOME=$(cd $HOME ; pwd)
 
 This was from someone's blogs post. And then if I want to start git
 bash from a different initial directory I just change the git bash
 shortcut Start In field to whatever directory.
 
 Anyways I've made a bunch of commits to my forked repo of dpl.org, and
 now have to figure out how to make a pull request. I haven't made any
 branches or anything because I'm way too new to this.
 
 I would also like to know how to uncommit a change which hasn't been
 pushed yet. So if I locally do:
 git add someFile.d
 git commit -m woops wrong comment

I recently starting using interactive rebasing which is a tremendous help 
for these kind of situations. This is usually what I do:

start a branch for work on feature foo:
  git checkout -b foo

* do a bunch of commits on foo *

update master with newest changes:
  git checkout master
  git pull

when foo is done, rebase it on top of master:
  git checkout foo
  git rebase -i master

This will popup your editor and let you squash some commits together and 
edit the message. The text in your editor is fairly self-explanatory. It 
also 'replays' the commits on top of those from master you have pulled in 
*after* creating the foo branch. This helps with two things: you can resolve 
any conflicts inside the foo branch and prevents annoying merge commits. It 
will look in history like you have starting the foo branch from the latest 
commit from master. Sometimes this is not what you want, but most of the 
time it makes sense.

From here you can either merge it with master (it will fast-forward) and 
push to github, or push the foo branch to a foo branch on github. Doing 
interactive rebasing like this allows you to organize the series of commits 
and messages *after* you are done developing something, resulting in very 
nice pull requests.

There is one thing you should never do: rebase a branch which you have 
already pushed to some place other people can see / use / depend on. Then 
you are taking away the history on which people have build. It is to be used 
strictly with private branches.

I use this workflow to work concurrently on lot's of different topics, each 
in a seperate branch. Without rebasing the history will be cluttered with 
merge commits. I also don't have to worry anymore about other people when I 
commit, since making nice messages and such is postponed to the point of a 
rebase. This makes life much more pleasant.


Re: There's new GIT instructions on Github now

2011-05-21 Thread Andrej Mitrovic
On 5/21/11, Vladimir Panteleev vladi...@thecybershadow.net wrote:
 If you just want to edit the commit message of your last commit, use:

 git commit -am New message

Super. Thanks.


Re: There's new GIT instructions on Github now

2011-05-21 Thread Andrej Mitrovic
On 5/21/11, David Nadlinger s...@klickverbot.at wrote:
 snip lots of awesome info

These are great, thanks. In fact, all of these tips deserve to be put
on a contributing code via git page on dwiki, which will have to be
made.


Re: There's new GIT instructions on Github now

2011-05-21 Thread Andrej Mitrovic
On 5/21/11, Lutger Blijdestijn lutger.blijdest...@gmail.com wrote:
 I recently starting using interactive rebasing which is a tremendous help
 for these kind of situations. This is usually what I do: snip

Ah, this could be quite useful. In one instance I've made a change,
committed (locally) and then found a typo in the code and had to make
another commit just to fix a typo I've introduced. So I could use
rebasing here (like merging two changes into one, I guess I can do
that?).


Re: [OT] Re: There's new GIT instructions on Github now

2011-05-21 Thread Lutger Blijdestijn
David Nadlinger wrote:

 On 5/21/11 1:09 PM, Lutger Blijdestijn wrote:
 And how well do projects from a professional version work in the free
 (Visual Studio Express) version?

 That should work, the professional version is mostly about extra ide
 features, the basics and the toolchain is exactly the same.
 
 I have encountered quite a few problems though. For example, 64 bit code
 generation used to be absent by default from Express versions (maybe it
 still is, haven't checked), which is a sensible marketing decision per
 se. However, it was implemented in such a way that I couldn't open a
 solution file from an open source project I was working on with my
 Express edition installation, just because it contained an x64 target…
 
 David

ouch, that sucks. Wikipedia suggests this works now for 2010 though.


Re: There's new GIT instructions on Github now

2011-05-21 Thread Andrej Mitrovic
Anywho, I'll start reading this http://progit.org/book/ to get the
hang of things.


Re: There's new GIT instructions on Github now

2011-05-21 Thread Lutger Blijdestijn
Andrej Mitrovic wrote:

 Anywho, I'll start reading this http://progit.org/book/ to get the
 hang of things.

That's a good book. I recommend to read closely chapter 3 and 9, goof around 
in a test repo and browse the .git/refs directory. Doing that made me 
understand how simple the core of git really is and then a lot of commands 
suddenly made much more sense.


Re: There's new GIT instructions on Github now

2011-05-21 Thread David Nadlinger

On 5/21/11 2:04 PM, Andrej Mitrovic wrote:

On 5/21/11, Lutger Blijdestijnlutger.blijdest...@gmail.com  wrote:

I recently starting using interactive rebasing which is a tremendous help
for these kind of situations. This is usually what I do:snip


Ah, this could be quite useful. In one instance I've made a change,
committed (locally) and then found a typo in the code and had to make
another commit just to fix a typo I've introduced. So I could use
rebasing here (like merging two changes into one, I guess I can do
that?).


Yes: Let's assume you have some commits A, B, C, D, E on your branch. 
Using »git rebase -i/--interactive HEAD~5«, you could choose to drop 
commit A altogether, merge C into B, and stop at commit D for editing.


Due to the comments in the generated file and the verbose console 
messages, »git rebase -i« is pretty much self-explanatory, just give it 
a try!


David


Re: There's new GIT instructions on Github now

2011-05-21 Thread Vladimir Panteleev
On Sat, 21 May 2011 14:58:55 +0300, Andrej Mitrovic  
andrej.mitrov...@gmail.com wrote:



On 5/21/11, David Nadlinger s...@klickverbot.at wrote:

snip lots of awesome info


These are great, thanks. In fact, all of these tips deserve to be put
on a contributing code via git page on dwiki, which will have to be
made.


How about this?

http://www.prowiki.org/wiki4d/wiki.cgi?PullRequest

--
Best regards,
 Vladimirmailto:vladi...@thecybershadow.net


Re: Should binary sharing be done using Mixin Template?

2011-05-21 Thread bearophile
Matthew Ong:

 Should D be able to do binary sharing when the same template is being 
 used for different data type.

There is no a single silver bullet to reduce template bloat and its negative 
effects. So this problem need to be faced from many different directions at the 
same time. One of the directions is the one you talk about. I am thinking about 
some class/struct/function annotation to ask the D compiler to use something 
closer to generics with auto boxing-unboxing for that class/function. It's 
useful in the spots where the full performance of templates is not needed (this 
happens in programs).

Bye,
bearophile


Re: There's new GIT instructions on Github now

2011-05-21 Thread Andrej Mitrovic
On 5/21/11, Vladimir Panteleev vladi...@thecybershadow.net wrote:
 How about this?

 http://www.prowiki.org/wiki4d/wiki.cgi?PullRequest


That's great.

We should link these from somewhere though as they're free-standing
pages that have to be search for to be found. Maybe a Contributing to
D section in one of the menus on the left (under About maybe?).


Re: There's new GIT instructions on Github now

2011-05-21 Thread Andrej Mitrovic
Nevermind, it's already linked from
http://www.prowiki.org/wiki4d/wiki.cgi?LanguageDevel but I didn't
realize it.

On 5/21/11, Andrej Mitrovic andrej.mitrov...@gmail.com wrote:
 On 5/21/11, Vladimir Panteleev vladi...@thecybershadow.net wrote:
 How about this?

 http://www.prowiki.org/wiki4d/wiki.cgi?PullRequest


 That's great.

 We should link these from somewhere though as they're free-standing
 pages that have to be search for to be found. Maybe a Contributing to
 D section in one of the menus on the left (under About maybe?).



Re: C undefined behaviour

2011-05-21 Thread bearophile
This follows:
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.Darticle_id=136205

Third part and last one:
http://blog.llvm.org/2011/05/what-every-c-programmer-should-know_21.html
http://www.reddit.com/r/programming/comments/hgk12/what_every_c_programmer_should_know_about/

This third article gives possible ideas for future safety improvements of D 
design :-) Every time you fix/avoid some of those problems, you erode away some 
costly and sometimes painful debugging time. So this work is ethically sound 
too.

Bye,
bearophile


Re: There's new GIT instructions on Github now

2011-05-21 Thread Andrej Mitrovic
Ok so apparently the reason why ~ would be added on delete is because
msysgit or something else (sh.exe?) thought the terminal was dead.
Something like that. Apparently a known bug, but you can add this into
~/.bashrc to fix it:
TERM=msys


Re: C undefined behaviour

2011-05-21 Thread bearophile
Regarding what I have said here:
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.Darticle_id=136205

A person has said me that Clang had the -ftrapu compiler switch to trap 
unsigned overflow too, but Chris removed it, because unsigned overflow is 
defined in the C standard. The discussion:

http://comments.gmane.org/gmane.comp.compilers.clang.devel/4469

The comment by Chris Lattner:

 I'm sorry I was too terse.  I don't want clang IR generation  
 supporting language features that are not useful for C/C++ etc.   
 Previously we had run-ins where you were trying to adapt the objc  
 runtime generation code to work with your objective-smalltalk  
 compiler, and this was causing the code to get contorted and be slow.
 
 I don't think it is ever a good idea to turn random unsigned  
 multiplies into overflow checked ones, so I don't think that -ftrapu  
 is useful for C programmers, so I think it should be removed.
 
 I *would* be supportive of an attribute on integer types that let  
 programmers opt in to overflow checking on particular values.  This  
 would be incredibly cool and generally useful because it doesn't break  
 the semantics of C.  I just am opposed to a global option that changes  
 how C works.

D doesn't need to follow such C design decisions. And even for C, Chris has 
broken and improved over some sclerotic design decisions of C compiler 
designers (even on little things, like Clang doesn't need a switch to compile 
C99 code!). So probably the generation of compiler writers successive to Chris 
will improve further. Compiler technology seems to move forward about ten times 
slower than other computer technology :-)

Bye,
bearophile


Re: There's new GIT instructions on Github now

2011-05-21 Thread Andrej Mitrovic
Well setting up the diff tool was a bitch. msysgit/git doesn't like
spaces no matter what is escaped. So I had to add the diff exe to PATH
and invoke it from a shell script, which itself is invoked by git.
Good thing I don't have to phone Linus home to invoke shell.exe to
invoke git to invoke a shell script to invoke diff.


Re: There's new GIT instructions on Github now

2011-05-21 Thread Vladimir Panteleev
On Sat, 21 May 2011 18:24:31 +0300, Andrej Mitrovic  
andrej.mitrov...@gmail.com wrote:



Well setting up the diff tool was a bitch. msysgit/git doesn't like
spaces no matter what is escaped. So I had to add the diff exe to PATH
and invoke it from a shell script, which itself is invoked by git.
Good thing I don't have to phone Linus home to invoke shell.exe to
invoke git to invoke a shell script to invoke diff.


Do you mean a custom diff tool, or perhaps a merge tool? git comes with a  
diff command...


--
Best regards,
 Vladimirmailto:vladi...@thecybershadow.net


Re: There's new GIT instructions on Github now

2011-05-21 Thread Andrej Mitrovic
So I did git log --stat on one of my test repos to view my logs,
scrolled to the bottom via hitting enter until I saw an END marker. So
now how do I exit back to the prompt? Hitting enter or escape or break
doesn't work.

God I hate wasting time on these stupid usability issues.


Re: There's new GIT instructions on Github now

2011-05-21 Thread Andrej Mitrovic
Yeah it comes with a diff command, I was trying to set up a custom one
actually. And I made it work so this is no longer a problem.


Re: There's new GIT instructions on Github now

2011-05-21 Thread Andrej Mitrovic
It was 'q'. I had to hit q. Well who would have thought.


Re: There's new GIT instructions on Github now

2011-05-21 Thread Vladimir Panteleev
On Sat, 21 May 2011 18:40:40 +0300, Andrej Mitrovic  
andrej.mitrov...@gmail.com wrote:



So I did git log --stat on one of my test repos to view my logs,
scrolled to the bottom via hitting enter until I saw an END marker. So
now how do I exit back to the prompt? Hitting enter or escape or break
doesn't work.

God I hate wasting time on these stupid usability issues.


Press q. Note that the component this relates to is less, which is a  
standard *nix utility.


You can press h to view the utility's online help, as well.

--
Best regards,
 Vladimirmailto:vladi...@thecybershadow.net


Re: There's new GIT instructions on Github now

2011-05-21 Thread Robert Clipsham

On 21/05/2011 09:14, Walter Bright wrote:

On 5/20/2011 7:52 AM, Don wrote:

Sorry, but your reply is a textbook example of fanboyism. On Windows,
git is an
utterly lousy product. And yes, I have both cygwin and Msys.


Reminds me of when I tried to run Latex on Windows. What a disaster.

Also, git just doesn't work right with files that end in CRLF. I fought
this for a while, and finally gave up. Everything I check in I run
through a converter which strips out the CR. No more troubles.


The install instructions mentioned eariler that started this whole 
debate has an installer which has an option to sort out line endings, is 
that not what you need? (see the screenshots on the link provided).


--
Robert
http://octarineparrot.com/


Re: There's new GIT instructions on Github now

2011-05-21 Thread Robert Clipsham

On 21/05/2011 09:14, Walter Bright wrote:

On 5/20/2011 7:52 AM, Don wrote:

Sorry, but your reply is a textbook example of fanboyism. On Windows,
git is an
utterly lousy product. And yes, I have both cygwin and Msys.


Reminds me of when I tried to run Latex on Windows. What a disaster.

Also, git just doesn't work right with files that end in CRLF. I fought
this for a while, and finally gave up. Everything I check in I run
through a converter which strips out the CR. No more troubles.


Also, doesn't your editor leave line endings in tact? Every editor I've 
used for programming detects the line endings and doesn't play with 
them, and they generally have an option to chose the default line ending 
style for new files.


--
Robert
http://octarineparrot.com/


Re: Should binary sharing be done using Mixin Template?

2011-05-21 Thread so
On Sat, 21 May 2011 15:49:16 +0300, bearophile bearophileh...@lycos.com  
wrote:


It's useful in the spots where the full performance of templates is not  
needed (this happens in programs).


What kind of applications are we talking about?
I can't imagine a situation where you sacrifice the performance (that you  
gain with templates) for a trivial issue like bloat,

when we finally get shared libraries, it will be even more trivial.


Re: There's new GIT instructions on Github now

2011-05-21 Thread Andrej Mitrovic
On 5/21/11, Vladimir Panteleev vladi...@thecybershadow.net wrote:
 Press q. Note that the component this relates to is less, which is a
 standard *nix utility.

 You can press h to view the utility's online help, as well.


Thanks.


Re: There's new GIT instructions on Github now

2011-05-21 Thread Walter Bright

On 5/21/2011 9:09 AM, Robert Clipsham wrote:

Also, doesn't your editor leave line endings in tact? Every editor I've used for
programming detects the line endings and doesn't play with them, and they
generally have an option to chose the default line ending style for new files.


My editor sets the line endings to match the default of the OS it is running 
under. In my experience, it is nearly always the right thing to do.


There isn't a right or wrong answer here, unfortunately. Unfortunately, even now 
a lot of unix programs still crash and burn with CRLF files (I'm looking at you, 
make on FreeBSD).




Re: There's new GIT instructions on Github now

2011-05-21 Thread Walter Bright

On 5/21/2011 9:07 AM, Robert Clipsham wrote:

The install instructions mentioned eariler that started this whole debate has an
installer which has an option to sort out line endings, is that not what you
need? (see the screenshots on the link provided).


There seem to be at least 6 ways of dealing with this on git. The documentation 
on each of them is execrable.


Git just has a fundamental problem with it - that is, git wants to make a unique 
hash for each file. That hash works on the binary contents of a file. Git also 
works with binary files.


So, what do you do with a file with CRLFs? Is it or is it not a binary file? Do 
you autodetect it and risk messing up a binary file? When you check in a file 
with CRLFs, do you convert it first to LFs? What happens when you check that 
file out? Do CRLFs get restored or not? Is a file changed if only CR's were 
added/deleted? How do you detect that?


There simply isn't a correct answer, and the 6 ways and their schizo 
documentation are utterly unclear about these issues.


The answer (for me) is to always strip CR's before git ever sees the files. 
Voila, no more issues.




Re: [OT] Re: There's new GIT instructions on Github now

2011-05-21 Thread Walter Bright

On 5/21/2011 1:47 AM, Russel Winder wrote:

On Sat, 2011-05-21 at 01:23 -0700, Walter Bright wrote:
[ . . . ]


I gave up again on using Unix to play music. I got tired of continually having
to reboot the machine to get it unhung.


Music plays just fine on Linux.  It also plays fine on Apple's brand of
Unix.  I haven't tried on Solaris recently.


Rhythmbox, the default music player on Ubuntu, does not. Oh, it'll work for a 
while, maybe a day or two, and then it'll freeze up. A reboot will revive it for 
a while, and then it'll corrupt its database, which has to be deleted and rebuilt.


Oh, and if you add some files to your shared music directory on your lan, just 
try to get Rhythmbox to rescan it and add the new files. Just try. Bah.




Re: There's new GIT instructions on Github now

2011-05-21 Thread Walter Bright

On 5/21/2011 8:44 AM, Andrej Mitrovic wrote:

It was 'q'. I had to hit q. Well who would have thought.


I was reading an article about older folks having problems setting the alarm on 
an iphone. They simply didn't realize that one has to press the '+' to set the 
alarm.


Re: There's new GIT instructions on Github now

2011-05-21 Thread Andrej Mitrovic
On 5/21/11, Walter Bright newshou...@digitalmars.com wrote:
 On 5/21/2011 8:44 AM, Andrej Mitrovic wrote:
 It was 'q'. I had to hit q. Well who would have thought.

 I was reading an article about older folks having problems setting the alarm
 on
 an iphone. They simply didn't realize that one has to press the '+' to set
 the
 alarm.


I took a look at the man-page (btw. for those not in the know, it's
called a man page because linux is for MEN, DAMMIT!).

It basically simulates vim keybindings (or whatever app first came up
with JKL movement keys).

But there are graphical glitches and text seems to disappear when I
scroll through the text lines. LOL.


Re: Should binary sharing be done using Mixin Template?

2011-05-21 Thread bearophile
so:

 What kind of applications are we talking about?

Let's say all applications longer than few thousands lines of code.


 I can't imagine a situation where you sacrifice the performance (that you  
 gain with templates) for a trivial issue like bloat,

Experience with profilers and with dynamic languages shows well that in all 
programs longer than few thousand lines a certain (sometimes good) percentage 
of the code doesn't influence much the performance of the whole program. So for 
such code other factors like code succinctness, safety, maintainability, and 
even binary compactness become more important than performance.


 when we finally get shared libraries, it will be even more trivial.

We will see. But I don't believe a single solution will solve this problem.

Bye,
bearophile


Re: D is back on Tiobe, now in position 23

2011-05-21 Thread Peter Alexander

On 21/05/11 7:02 AM, Russel Winder wrote:

I disagree that it is useless.  It is interesting on two grounds:

1.  If you have any sort of idea about what they are actually measuring
and are careful no to over-infer, it is a very interesting measure of
what is interesting to people in the Web-verse.  It is a measure of
buzz.


It doesn't measure buzz.

What are the 'buzz' languages at the moment? Clojure and Scala are both 
definitely buzzing at the moment and generating a lot of interest on the 
web, yet Scala isn't in the top 50 and Clojure isn't even in the top 100.


If you can show me in any way how the programming language Avenue is 
buzzing more than Clojure (or is more popular on any measure) then I'll 
be impressed.


Re: There's new GIT instructions on Github now

2011-05-21 Thread Nick Sabalausky
Walter Bright newshou...@digitalmars.com wrote in message 
news:ir8uro$151e$1...@digitalmars.com...
 On 5/21/2011 9:09 AM, Robert Clipsham wrote:
 Also, doesn't your editor leave line endings in tact? Every editor I've 
 used for
 programming detects the line endings and doesn't play with them, and they
 generally have an option to chose the default line ending style for new 
 files.

 My editor sets the line endings to match the default of the OS it is 
 running under. In my experience, it is nearly always the right thing to 
 do.


I'm becoming convinced that just using Unix-style \n even on Windows is 
nearly always the right thing to do. Windows Notepad is the only Windows 
program I've come across that still has any problem with Unix-style line 
endings. And what programmer ever uses that? Everything else handles \n just 
fine these days, even on Windows. (With the possible exception of Batch 
files - I haven't tried that...)

 There isn't a right or wrong answer here, unfortunately. Unfortunately, 
 even now a lot of unix programs still crash and burn with CRLF files (I'm 
 looking at you, make on FreeBSD).





Re: D Blog...

2011-05-21 Thread Peter Alexander

Reddit has killed your blog!

Server is too busy



On 21/05/11 3:08 AM, Lloyd Dupont wrote:

hay, I didn't know reddit!
some comments are quite funny!

Walter Bright wrote in message news:ir6aa1$2o0a$1...@digitalmars.com...

On 5/20/2011 4:58 AM, Lloyd Dupont wrote:

I just wrote an article on my blog (not much happening on it though, I
confess..)

Which should explain to a .NET programmer how to have an easy and
satisfying
start with D:

http://www.galador.net/codeblog/post/2011/05/20/D-for-NET-programmer.aspx


Reddit:

http://www.reddit.com/r/programming/comments/hfuj4/starting_programming_in_d_guide_for_net_programmer/





Efficiency of functional code

2011-05-21 Thread bearophile
(The topic of this post is just one: efficient compilation of code that uses 
higher order functions a lot. This post is not really about Haskell, or many 
other things.)

I am learning more Haskell, and I am back-translating most of my Haskell code 
to D2 too. I am getting more experience on code like this, that performs a 
Schwartzian sort:

swsort key = map snd . sortBy (comparing fst) . map (key  id)

In that code this unusual arrow:
(key  id)
means something like this lambda:
\x - (key x, x)

In Haskell many of my functions are 1 line long, and often less than four 
lines. So the comment that Walter says often against shallow single-line Phobos 
functions doesn't apply to Haskell :-)

In Haskell code loops, explicit recursion, and even lambdas are not common. 
Even blocks of pattern matching inside a function are less appreciated than 
functions defined one piece at a time with pattern matching on just their 
arguments.

I am also doing many benchmarks. One thing I'm seeing is that the GHC Haskell 
compiler is very good at removing the overhead of higher-order functions (much 
better than DMD). If D wants to encourage functional-style code, that uses a 
lot the higher order functions of Phobos, then I think the D compiler has to 
learn to compile them quite better than now. I don't have enough experience of 
compilers yet, so I don't know how to do this. (I just think that the 
conditional purity feature will help compile better the Phobos HOFs).

Bye,
bearophile


More static introspection

2011-05-21 Thread bearophile
If D will want to introduce user-defined @attributes then I think it's better 
to pre-adapt the language  compiler to them. To define many attributes you 
first need a good amount of static introspection.

Example: how do you define a @pure (similar to the built-in pure keyword) in 
user-code? Let's say there is no syntax yet to define @attributes. Then you use 
just a static assert:

int foo(int x) { return x * x; }
static assert(isPure!foo);

isPure() is a compile-time function that later may become a @pure, when there 
is syntax to define user attributes.

But before the syntax for user-defined attribute the language needs means to 
create isPure(). To do this some more __traits are enough. Given the name of a 
function a trait may list its variables, another trait may give a list of the 
functions it calls, etc. With another trait to list the global variables and 
some recursive code I think you become able to write isPure().

Once such static introspection is present, and later when there is syntax to 
define user attributes, then in theory you are even able to remove pure from 
D2/D3 and just keep @pure in the object module.

More power allows some DMD front-end code to be removed to become user code (or 
almost user code if it's in object).

(There are @attributes that probably need to perform run-time computations, so 
the kind of @attributes I have described in this post is not the whole picture).

Bye,
bearophile


Re: Should binary sharing be done using Mixin Template?

2011-05-21 Thread Jonathan M Davis
On 2011-05-21 09:13, so wrote:
 On Sat, 21 May 2011 15:49:16 +0300, bearophile bearophileh...@lycos.com
 
 wrote:
  It's useful in the spots where the full performance of templates is not
  needed (this happens in programs).
 
 What kind of applications are we talking about?
 I can't imagine a situation where you sacrifice the performance (that you
 gain with templates) for a trivial issue like bloat,
 when we finally get shared libraries, it will be even more trivial.

There are plenty of cases where programs don't care about effeciency much, so 
any gain you get from templates over generics doesn't really matter. There are 
also plenty of cases where it doesn't really matter that templates increase 
the size of the executable in comparison to generics. It depends on what 
you're doing. On honestly, I think that a lot of the arguments one way or the 
other stem from perception rather than reality. Some people are brought to 
believe that templates are bloated and that the way that generics do things is 
inherently better because of that. Others are brought to believe that generics 
are slow and that templates are better because of that. There is some truth to 
both sides, but unless you're creating a programming language and choosing 
whether you're going to implement templates or generics or if you're going to 
use that as a factor in choosing which programming langage that you're going 
to use, it doesn't really matter. Each language does it it's own way, and if 
you're using a particular language, you're pretty much stuck with how it does 
things. D happens to use templates, so if you're using D, you get templates 
not generics.

Really, I think that the key thing that needs to be understood here is the key 
nature of templates and how that differs from generics. If you're using Java, 
you need to understand what generics are and how they work so that you can 
best understand how to use them. Trying to make them act like templates 
doesn't work. The same goes for D, except in reverse. You need to understand 
templates an how they work so that you can best use them. Templates are 
heavily used in Phobos, and anyone who doesn't understand what templates 
really are is going to be at a disadvantage.

At their heart, templates are a tool for code generation. They allow you to 
create functions and types which use different types without having to type 
all of the different functions and types yourself, and they do it by 
generating code. This has far-reaching consequences. One of the coolest is 
eponymous templates (such as std.metastrings.Format). You couldn't do anything 
like eponymous templates with generics.

The fact that templated stuff can be specialized on type and entirely change 
what its implementation is based on its arguments is also incredibly powerful. 
One instance of that that I find very cool is core.time.convert. It takes two 
strings indicating the units of time that you want to convert to and from and 
the value that you want to convert, and it is able to generate the exact 
function which converts those specific units. With full optimizations on, it 
probably becomes an inlined expression which is very short and exactly what is 
needed for converting the value that you gave it to the units that it should 
be in. You don't have to have a bunch of different functions for doing 
conversions, and the function that you do use doesn't even need any if 
statements. It's all done at compile time with static ifs, and the result 
should be quite inlinable. You can't do anything like that with generics. You 
can do it with templates because what they are is code generation, not a way 
to inserts casts for you.

Ultimately, regardless of whether a programmer prefers generics or templates, 
when they use a language that uses them, they need to understand what they are 
and how they work so that they can best use them. Trying to pervert one into 
the other is only going to give you trouble. One would hope that the compiler 
writers would be able to optimize whichever the language uses in the best 
manner possible, and I'm sure that more can be done in that area in D, but you 
still need to understand the difference between generics and templates and why 
the way that they are if you want to use them efficiently and appropriately.

- Jonathan M Davis


Re: D is back on Tiobe, now in position 23

2011-05-21 Thread Paulo Pinto
And both D and Go win over VB.Net!

I know it is of topic for this group, but since bearophile sometimes talks 
about Ada,
what makes me wonder is why Ada is being steadly growing since 2010.

For some languages it is easy to know why their usage has grown. For example
the Objective-C spike happens around the time the native iPhone SDK became
available. Ruby around the time Ruby on Rails started appearing on everyones
blog.

So what about Ada?

Unfortunely for D, there is still no chart available, but I would say your 
book,
might represent such a spike as well.

--
Paulo

Andrei Alexandrescu seewebsiteforem...@erdani.org wrote in message 
news:ir6jiv$74q$1...@digitalmars.com...
 http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html

 Andrei 




Re: [OT] Re: There's new GIT instructions on Github now

2011-05-21 Thread Russel Winder
On Sat, 2011-05-21 at 11:15 -0700, Walter Bright wrote:
[ . . . ]
 Rhythmbox, the default music player on Ubuntu, does not. Oh, it'll work for a 
 while, maybe a day or two, and then it'll freeze up. A reboot will revive it 
 for 
 a while, and then it'll corrupt its database, which has to be deleted and 
 rebuilt.
 
 Oh, and if you add some files to your shared music directory on your lan, 
 just 
 try to get Rhythmbox to rescan it and add the new files. Just try. Bah.

Your experience of Rhythmbox is totally inconsistent with my experience
of Rhythmbox.  I run it for days on end without hassle.  I am using
0.12.8 (Debian Testing), which version are you using?

Ubuntu have dropped Rhythmbox for Banshee.  Reasons unknown.
Consequences:  Ubuntu now depends on Mono even more than ever.  One
assumes Canonical will indemnify Ubuntu users against any possible M$
patent attack.

-- 
Russel.
=
Dr Russel Winder  t: +44 20 7585 2200   voip: sip:russel.win...@ekiga.net
41 Buckmaster Roadm: +44 7770 465 077   xmpp: rus...@russel.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: There's new GIT instructions on Github now

2011-05-21 Thread Russel Winder
On Sat, 2011-05-21 at 11:00 -0700, Walter Bright wrote:

 There isn't a right or wrong answer here, unfortunately. Unfortunately, even 
 now 
 a lot of unix programs still crash and burn with CRLF files (I'm looking at 
 you, 
 make on FreeBSD).

Any Sh/Bash/Csh script with a #! line with CRLF on the end fails
dismally on all non-Windows platforms tried.  Must be a kernel thing.

-- 
Russel.
=
Dr Russel Winder  t: +44 20 7585 2200   voip: sip:russel.win...@ekiga.net
41 Buckmaster Roadm: +44 7770 465 077   xmpp: rus...@russel.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: How to 'add' functions to existing type/class/struct/interface...

2011-05-21 Thread Matthew Ong

On 5/19/2011 11:23 PM, Adam D. Ruppe wrote:

How to 'add' functions to existing type/class/struct/interface...


You don't. It seems to be that this would break encapsulation anyway.
This block of comments is totally not related to this thread, but just 
to set the record straight.


Not entirely. Only data that you deem safe are expose. Go does not have 
public/private keyword, but they uses first letter of the Identifier of 
Functions or Variables to define encapsulation(strange+implied).


Uppercase first letter = Public.
lowercase first letter = Private.



I read from Adam that it is possible and is done within Phobos by D.
Could some one provide some sample code to explain that.


Look in std.range for full examples but here's a brief one:

Ok. Thanks.

void doSomething(T)(T item) if( isMyInterface!T ) {
  // use item here
}
template isMyInterface(T) {
  static if(is(typeof(
// write some code to test the interface here

 ... Do not know what is done here because I am new.

  )))
  enum bool isMyInterface = true;
  else
  enum bool isMyInterface = false;
}
Because I am new to D, That is a very strange syntax to me. I suppose 
the std.range example may give more clarity.




You can also use the template straight up, though that's less
structured:

auto doSomething(T)(T obj) {
  // write whatever you want here using obj
  // it won't compile if the obj doesn't match the used functions
}
This example is more like a static generics in Java for me. But it is a 
form of the polymorphic ability. It does not add



Or, you can go with a more strictly Go style by using method #1
and automating the isMyInterface detection. Kenju Hara wrote
an adaptTo function that does something like this:

interface Interface {
 void foo();
}


class A { // note it doesn't list the interface here
  void foo();
}

void func(Interface i) { }


A a = new A();

func(adaptTo!Interface(a));


I don't think this has been committed to Phobos yet though.
This last example fits the Go interfaces example the best. I think, but 
there is no code for adaptTo(T). There is no clear idea how this is done.


From what I can see Go is doing is like in C/C++:
1) using structure to define the data-type. // Class Object is more 
expensive.
2) static functions that bind to that structure datatype. Such static 
functions can be define within the LIB or introduced as new functions 
outside the library.

3) using some form of function pointer to call those static functions.

--
Matthew Ong
email: on...@yahoo.com



Re: How to print unicode like: こ ん に ち は 世界

2011-05-21 Thread Matthew Ong

On 5/20/2011 2:55 PM, Russel Winder wrote:

On Thu, 2011-05-19 at 22:37 +0200, Andrej Mitrovic wrote:
[ . . . ]

You would also need a Unicode-aware font, maybe Lucida or something
similar. Typically fixed-point fonts used for programming have little
support for Unicode characters, and you would get back a black or
white box like [].


Alternatively use a nice proportional font with Unicode support for code
so it is more readable?

Backward compatibility with 80x24 terminals is just so last millennium.


Hi All,

Thanks for the example code on the unicode issue.

hi Andrej,
version(Windows)
{
   import std.c.windows.windows;
   extern(Windows) BOOL SetConsoleOutputCP(UINT);
}

void main()
{
   version(Windows) SetConsoleOutputCP(65001);
   writeln(Hello, world; or Καλημέρα κόσμε; or こんにちは 世界);
}

I am running this on a M$ Vista Professional edition.

Unfortunately that code sample does not work... Please see attachment.

The reason I am testing this is to understand how the stream library works.

Console test is fundamental test to see if the language handles unicode 
within the source code itself automatically and display them correctly 
when it does file IO, network and also GUI level.


Normally in mordern languages it should, because that allow a developer 
to easily define a simple resource bundle file to loaded automatically 
within the same fragment of code. If not, then, there is going to be 
problem. I hope we do not need to write such code:


version(English){
   // some code
}version(Chinese_MainLand){
  // some other code
}version(Chinese_HongKong){
  // yet another code
}...etc

I have originally plan to send an attached screen shot but it is not 
working for the newsgroup. Perhaps someone can show me how to do that here.


--
Matthew Ong
email: on...@yahoo.com



Re: How to print unicode like: こ ん に ち は 世界

2011-05-21 Thread Matthew Ong

On 5/21/2011 2:46 PM, Matthew Ong wrote:

On 5/20/2011 2:55 PM, Russel Winder wrote:

On Thu, 2011-05-19 at 22:37 +0200, Andrej Mitrovic wrote:
[ . . . ]

You would also need a Unicode-aware font, maybe Lucida or something
similar. Typically fixed-point fonts used for programming have little
support for Unicode characters, and you would get back a black or
white box like [].


Alternatively use a nice proportional font with Unicode support for code
so it is more readable?

Backward compatibility with 80x24 terminals is just so last millennium.


Hi All,

Thanks for the example code on the unicode issue.

hi Andrej,
version(Windows)
{
import std.c.windows.windows;
extern(Windows) BOOL SetConsoleOutputCP(UINT);
}

void main()
{
version(Windows) SetConsoleOutputCP(65001);
writeln(Hello, world; or Καλημέρα κόσμε; or こんにちは 世界);
}

I am running this on a M$ Vista Professional edition.

Unfortunately that code sample does not work... Please see attachment.

The reason I am testing this is to understand how the stream library works.

Console test is fundamental test to see if the language handles unicode
within the source code itself automatically and display them correctly
when it does file IO, network and also GUI level.

Normally in mordern languages it should, because that allow a developer
to easily define a simple resource bundle file to loaded automatically
within the same fragment of code. If not, then, there is going to be
problem. I hope we do not need to write such code:

version(English){
// some code
}version(Chinese_MainLand){
// some other code
}version(Chinese_HongKong){
// yet another code
}...etc

I have originally plan to send an attached screen shot but it is not
working for the newsgroup. Perhaps someone can show me how to do that here.


Hi All,
correction on my part. It does seem like a font issue. Strangely the 
same console program that used to be able to show unicode correctly for 
both java and go is no longer working???


I think it is true, it has nothing to do with D. More like a font thing.

The result I got working is within the Eclipse Java and Go Console but 
NOT the DDT D console.


Without IDE, all of them show garbage...
Perhaps some one can kindly show me how the console fonts setting works 
for M$ Vista.


Unicode-aware font, maybe Lucida How I tried Lucida it also does not 
work. There is only 2 fonts shown int the Command Prompt Properties Font 
Tab.


--
Matthew Ong
email: on...@yahoo.com



Re: How to break module into multiple file.

2011-05-21 Thread Matthew Ong

On 5/20/2011 4:23 AM, Nick Sabalausky wrote:

Matthew Ongon...@yahoo.com  wrote in message
news:ir3801$84b$1...@digitalmars.com...

On 5/14/2011 3:17 AM, Nick Sabalausky wrote:

Jason Housejason.james.ho...@gmail.com   wrote in message



But yea, one-class-per-file is really a Java thing (and then a few other

Not true entirely, the limit is one public class per file. There is no
actual limit for such:
// The file must be ClassA.java

public class ClassA{}

class ClassB1{}
class ClassB2{}
class ClassB3{}
class ClassB4{}...







I see. But in any case, D allows multiple public classes in one file, FWIW.
Yes. I agree that the multiple public class per file is good. I can the 
uses of that when it does not come into library but in Web Page 
Rendering, Business Logic Layer and GUI Logic Layer(Java really messes 
thing up here for swing GUI.)






languages kind of ape'd it.). No need to force youself into that in D.


As for the real reason it is for:
That current D layout seem to limit that one file to a single developer.
Instead of multiple classes by multiple developers within the same module.

Using the example:
HashMap  Unit tested implemented by matthew
LinkedList  Unit tested implemented by john
but the same module is handled by Jonathan for other classes?



That's what version control systems are for. As long as you're using a VCS
that isn't terrible (ie, as long as you're not using CVS or Visual
SourceSafe), than it's easy for multiple people to edit the same source
file.
OK. I read somewhere else about this, I think there is same issue for 
SubVersion?

Someone suggested Hg.

But that does not work well for some security centric applications like 
where they divide up even the accountability of the developer to the 
code. How can someone proof that if multiple person changes the same 
peace of code. Like in Defence and Banking people might ask this questions.





But Nick,
-- ...to this: ---

// libfoo/all.d
module libfoo.all;
public import libfoo.partA;
public import libfoo.partB;
public import libfoo.partC;

That does the trick.


Great :)
The breaking up allow me to even hide some class that I do not want. I 
think I begin to understand how D does its package/module layout.
Using the approach that you shown here, allow me to think about how to 
migrate some of the Java API I have coded.





Now my only concern is that when does D linked like C++ or dynamic
selective linked on import that is ONLY really used and not linked ALL
that is importedSuch thing does not happen in Java because linking is
done during runtime by Class Loader. I wonder the loader in D for DLL is
as intelligent.



AIUI, automatic DLL loading is handled by windows, not D (but I think you
can also load DLLs manually). Also, D is usually linked statically, not
dynamically. I know it's possible for a static linker to eliminate code
that's not used, but I don't think OPTLINK (D's linker on windows) currently
does it.

Now. That is a feature request to be seriously look into.


--
Matthew Ong
email: on...@yahoo.com



How to interface with existing Java Code at the API level.

2011-05-21 Thread Matthew Ong

Hi,

D has major potential to replace C/C++ at the system API level.
What I can see D is doing now is trying to glue to the existing C API
instead of replacing that OLD OLD language.

But it is too early to see if that is the case at the Business 
Application level to replace enterprise level resources(like JMS/MQ, .


Because of this, D could be a strong enhancement:
1) to allow other VM base language to interface with the native layer of 
the OS that they are sitting on.

2) hiding some implementation logic in pure machine binary.
3) speeding up some existing IO/Hardware interfacing that is not able
to be done by Java/C# directly.

I am not too sure how the D dll works completely, but I guess. The end 
results would be same as a C dll. but how to figure out the header file 
in the C compatible as that was written in D.


Then some example would needed to be provided

From what I can see, as a starting show case project.

https://github.com/wmeissner/jffi



--
Matthew Ong
email: on...@yahoo.com



Re: How to break module into multiple file.

2011-05-21 Thread Nick Sabalausky
Matthew Ong on...@yahoo.com wrote in message 
news:ir7qio$28mn$1...@digitalmars.com...
 On 5/20/2011 4:23 AM, Nick Sabalausky wrote:
 Matthew Ongon...@yahoo.com  wrote in message
 news:ir3801$84b$1...@digitalmars.com...

 As for the real reason it is for:
 That current D layout seem to limit that one file to a single developer.
 Instead of multiple classes by multiple developers within the same 
 module.

 Using the example:
 HashMap  Unit tested implemented by matthew
 LinkedList  Unit tested implemented by john
 but the same module is handled by Jonathan for other classes?


 That's what version control systems are for. As long as you're using a 
 VCS
 that isn't terrible (ie, as long as you're not using CVS or Visual
 SourceSafe), than it's easy for multiple people to edit the same source
 file.
 OK. I read somewhere else about this, I think there is same issue for 
 SubVersion?
 Someone suggested Hg.


Subversion handles multiple people editing the same file perfectly fine. But 
Hg probably is better than SVN, overall. I've been a happy SVN user for a 
long time, but even I'm starting to get won over by Hg. Of course, some 
people like Git better than Hg (and some people like Hg better than Git).




Some help on Mixin Template at Class level.

2011-05-21 Thread Matthew Ong

Hi,

As the documentation at D ONLY shows template at functions level and 
also ONLY the content of a class but without the definition of a class.

Could this code be working? Or did I miss out some syntax.

mixin template AType(alias T, U, alias V){
class T : ClassC { // Class level Template
private:
U value;
public:
this(){}
void print(){}
mixin V;
} // End Class
}

class ClassC {}

mixin template btype() {
void someFunction() {}; // Content of a class.

}

mixin AType!(ClassB, string, btype);

void main() {
ClassC r = new ClassB();
}


  Build Commands:  
-odbin
-ofbin\TestTemplate.exe

-Isrc

src\Sample.d

src\Sample.d(20): Error: undefined identifier ClassB, did you mean class 
ClassC?

src\Sample.d(20): Error: ClassB is used as a type

Thanks very much for helping out.

--
Matthew Ong
email: on...@yahoo.com



Re: How to interface with existing Java Code at the API level.

2011-05-21 Thread Jonathan M Davis
On 2011-05-21 01:04, Matthew Ong wrote:
 Hi,
 
 D has major potential to replace C/C++ at the system API level.
 What I can see D is doing now is trying to glue to the existing C API
 instead of replacing that OLD OLD language.
 
 But it is too early to see if that is the case at the Business
 Application level to replace enterprise level resources(like JMS/MQ, .
 
 Because of this, D could be a strong enhancement:
 1) to allow other VM base language to interface with the native layer of
 the OS that they are sitting on.
 2) hiding some implementation logic in pure machine binary.
 3) speeding up some existing IO/Hardware interfacing that is not able
 to be done by Java/C# directly.
 
 I am not too sure how the D dll works completely, but I guess. The end
 results would be same as a C dll. but how to figure out the header file
 in the C compatible as that was written in D.
 
 Then some example would needed to be provided
 
  From what I can see, as a starting show case project.
 
 https://github.com/wmeissner/jffi

The likely way to interface between D and Java would be to use a C (or maybe 
C++) interoperability layer in between them. I'm not sure that it can 
realistically be done any other way at this point.

- Jonathan M Davis


Re: Some help on Mixin Template at Class level.

2011-05-21 Thread Simen Kjaeraas

On Sat, 21 May 2011 10:54:54 +0200, Matthew Ong on...@yahoo.com wrote:


mixin template AType(alias T, U, alias V){
class T : ClassC { // Class level Template


This gives you a class called T. You seem to want it to have the name
you pass as a string, in which case you have to use string mixins.


private:
 U value;
public:
 this(){}
 void print(){}
 mixin V;
} // End Class
}

class ClassC {}

mixin template btype() {
 void someFunction() {}; // Content of a class.

}

mixin AType!(ClassB, string, btype);

void main() {
 ClassC r = new ClassB();
}


As mentioned above, in order to use the name from the template parameter
you need to use string mixins. Here is how I would do it:

string ATypeGenerator( string name ) {
return class  ~ name ~  : ClassC {
private:
U value;
public:
this(){}
void print(){}
mixin V;
};
}

mixin template AType( string name, U, alias V ) {
mixin( ATypeGenerator( name ) );
}

mixin AType!(ClassB, string, btype);

void main() {
ClassC r = new ClassB();
}


--
Simen


Re: What is this strange alias syntax?

2011-05-21 Thread Simen Kjaeraas

On Sat, 21 May 2011 05:12:20 +0200, Andrej Mitrovic n...@none.none wrote:


Taken from the docs:

alias int func(int);
void main()
{
if ( is(func[]) )   // not satisfied because arrays of
writeln(satisfied);// functions are not allowed
else
writeln(not satisfied);
}

It will print not satisfied. But I'm not sure what func is supposed to  
be? An alias.. to what? I can't declare variables of its type:

func x;
error:  variable test.main.x cannot be declared to be a function

Of course if you write the alias the usual way it will print  
'satisfied'. Nothing strange about having an array of functions in D:


alias int function(int) func;
void main()
{
if ( is(func[]) )
writeln(satisfied);
else
writeln(not satisfied);
}


It's the old C syntax for defining function pointers. Well, without the
pointer. And that last part is important, because the latter example is
an array of function pointers, with which D has no issue.

--
  Simen


Re: Some help on Mixin Template at Class level.

2011-05-21 Thread Matthew Ong

On 5/21/2011 5:12 PM, Simen Kjaeraas wrote:

On Sat, 21 May 2011 10:54:54 +0200, Matthew Ong on...@yahoo.com wrote:


mixin template AType(alias T, U, alias V){
class T : ClassC { // Class level Template


This gives you a class called T. You seem to want it to have the name
you pass as a string, in which case you have to use string mixins.


private:
U value;
public:
this(){}
void print(){}
mixin V;
} // End Class
}

class ClassC {}

mixin template btype() {
void someFunction() {}; // Content of a class.

}

mixin AType!(ClassB, string, btype);

void main() {
ClassC r = new ClassB();
}


As mentioned above, in order to use the name from the template parameter
you need to use string mixins. Here is how I would do it:

string ATypeGenerator( string name ) {
return class  ~ name ~  : ClassC {
private:
U value;
public:
this(){}
void print(){}
mixin V;
};
}

mixin template AType( string name, U, alias V ) {
mixin( ATypeGenerator( name ) );
}

mixin AType!(ClassB, string, btype);

void main() {
ClassC r = new ClassB();
}



Hi, Thanks for the respond.
I am really new to D.
Using your code I have this error:

src\Sample.d(16): Error: undefined identifier btype, did you mean 
template AType(string name,U,alias V)?
src\Sample.d(16): Error: mixin AType!(ClassB,string,_error_) does not 
match template declaration AType(string name,U,alias V)


Could you please ensure it is compilable code and so that I can test the 
template shown by you.


--
Matthew Ong
email: on...@yahoo.com



Re: How to break module into multiple file.

2011-05-21 Thread Russel Winder
On Sat, 2011-05-21 at 04:35 -0400, Nick Sabalausky wrote:
[ . . . ]
 Subversion handles multiple people editing the same file perfectly fine. But 
 Hg probably is better than SVN, overall. I've been a happy SVN user for a 
 long time, but even I'm starting to get won over by Hg. Of course, some 
 people like Git better than Hg (and some people like Hg better than Git).

And there is also Bazaar.


-- 
Russel.
=
Dr Russel Winder  t: +44 20 7585 2200   voip: sip:russel.win...@ekiga.net
41 Buckmaster Roadm: +44 7770 465 077   xmpp: rus...@russel.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: web development in D

2011-05-21 Thread Trass3r

Have a look at the recent thread titled 'How To Dynamic Web Rendering?'
Adam Ruppe has created a package for web development with D and it seems  
to work like a charm.


Re: How to interface with existing Java Code at the API level.

2011-05-21 Thread Robert Clipsham

On 21/05/2011 09:58, Jonathan M Davis wrote:

On 2011-05-21 01:04, Matthew Ong wrote:

Hi,

D has major potential to replace C/C++ at the system API level.
What I can see D is doing now is trying to glue to the existing C API
instead of replacing that OLD OLD language.

But it is too early to see if that is the case at the Business
Application level to replace enterprise level resources(like JMS/MQ, .

Because of this, D could be a strong enhancement:
1) to allow other VM base language to interface with the native layer of
the OS that they are sitting on.
2) hiding some implementation logic in pure machine binary.
3) speeding up some existing IO/Hardware interfacing that is not able
to be done by Java/C# directly.

I am not too sure how the D dll works completely, but I guess. The end
results would be same as a C dll. but how to figure out the header file
in the C compatible as that was written in D.

Then some example would needed to be provided

  From what I can see, as a starting show case project.

https://github.com/wmeissner/jffi


The likely way to interface between D and Java would be to use a C (or maybe
C++) interoperability layer in between them. I'm not sure that it can
realistically be done any other way at this point.

- Jonathan M Davis


As a side note, Bernard Helyer is working on import(Java) for his D 
compiler, and I believe Andrei is trying to persuade him to port it to 
work with dmd once he's done - 
https://github.com/bhelyer/SDC/commit/41d54a7a1fc57c3745493ee69b2be7bb59dc04c6 
- I believe that allows for import(Java) my.java.class;


--
Robert
http://octarineparrot.com/


Re: web development in D

2011-05-21 Thread Adam D. Ruppe
Yea, the Dynamic Web Rendering thread just went over this, so
shouldn't be hard to find that thread.

It went into discussing my method and got a little long, but the
summary is:

You can write web apps in D using the standard CGI interface or
a long lived process (embedded http server or whatever.)

My code works best with standard CGI, cgi.d in here:
http://arsdnet.net/dcode/

I also have an httpd.d (requires netman.d) that lets the cgi
interface work with an embedded server, but it's single threaded
so that can be a problem. It's not production ready.

Regular cgi though works with other existing web servers, is
easy to use, and actually performs quite well.

(You'll find a lot of people complaining on the internet that
CGI is slow, but check the date on those articles and see if they
are using Perl or native compiled binaries.

Usually they are very old and using an interpreter - that's why
it is slow. A native binary over cgi is quite fast.)



The stuff you build on top of cgi can be whatever you want. I
personally use my dom.d and web.d modules for templating and
some automatic code generation, but you can spin your own libs
too.


Re: web development in D

2011-05-21 Thread Nick Sabalausky
joe j...@studiofortress.com wrote in message 
news:ir8frr$ait$1...@digitalmars.com...

 Second, from your own experience using D do think it would make a good or 
 bad
 choice for a web development language?

I'd really say that a good choice for a web development language is whatever 
you find to be a good choice for a language. Personally, I love D. It's my 
favorite language, and out of all the languages I've used (many over the 
years) it's really the only one I'm overall happy with (but then, I'm 
notoriously picky ;) ). So I find D to be an excellent choice for a web 
development language since I personally find D to be an excellect language. 
OTOH, if someone happened to absolutely hate D, then D probably wouldn't be 
a very good choice for them for a web development language.

There is one other factor to consider, though: You need to think about what 
server or servers it will need to run on:

If, for example, you need it to be able to run on pretty much any shared web 
host out there, then you're pretty much stuck with either PHP or something 
like Haxe that compiles down to PHP. And that defintiely won't help you with 
performance, and it'll only help alleviate *some* of PHP's probelms, not all 
of them. That's the unfortunate state of shared web hosting :/

If, OTOH, you only need it to run on one specific server and you don't have 
complete control over it (for example, if it's a shared web host, or if it's 
run by some separate IT department thet you're not part of), then naturally 
you'll need to see what the server supports and make your choice from those. 
But keep in mind one thing I've learned the hard way: Just because they say 
they support CGI does *not* necessarily mean they support CGI from a 
natively compiled langauge (which D is). So make sure to get clarification 
on that.

And, of course, if you have total control over the server, then naturally 
you can choose whatever you want.

Oh, but unless you do have direct access to the server and total control 
over it, I would recommend against ASP.NET. Not because I really have 
anything against ASP.NET, Windows or MS, per se. It's just that ASP.NET 
typically requires a Windows server, and shared Windows hosts usually don't 
provide any way to set up things like file permissions and internal URL 
rewriting. And not being able to do those things can often be a problem.





Re: .init of field == type's initializer or field initializer?

2011-05-21 Thread Stewart Gordon

On 20/05/2011 04:19, Andrej Mitrovic wrote:
snip

Foo.b.init is actually 0. Are the docs wrong, or is the compiler wrong? Let me 
know so
I can fix the docs if necessary as I'm doing that now.


Known issue:
http://d.puremagic.com/issues/show_bug.cgi?id=5715

Stewart.


[Issue 5885] wrong codegen for OPu32_d

2011-05-21 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5885


d...@dawgfoto.de changed:

   What|Removed |Added

 Attachment #948 is|0   |1
   obsolete||


--- Comment #1 from d...@dawgfoto.de 2011-05-21 05:08:47 PDT ---
Created an attachment (id=988)
new fix

The proposed patch was wrong. FILD m64int needs to be used as there are no
unsigned-fpu load instructions. The new patch explicitly zeros the upper 4
bytes.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 6042] New: registers not preserved across method call

2011-05-21 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6042

   Summary: registers not preserved across method call
   Product: D
   Version: D2
  Platform: x86_64
OS/Version: All
Status: NEW
  Severity: major
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: d...@dawgfoto.de


--- Comment #0 from d...@dawgfoto.de 2011-05-21 05:36:44 PDT ---
void destroysXMM1(float a, float b) {
}

void assertSame(float a, float b) {
  assert(a == b);
}

class Bug {
  @property float xval() const {
destroysXMM1(0.0f, 0.0f);
return 2.0f;
  }

  void show() {
assertSame(xval, xval);
  }
}

void main() {
  auto bug = new Bug();
  bug.show();
}



This is the generated code.
mov0xfff8(%rbp),%rdi
mov(%rdi),%rax
rex64 callq  *0x30(%rax)
movsd  %xmm0,0xfff0(%rbp)
movsd  0xfff0(%rbp),%xmm1
mov0xfff8(%rbp),%rdi
mov(%rdi),%rcx
rex64 callq  *0x30(%rcx)
callq  40162c _D3bug10assertSameFffZv

The return value of the first parameter evaluation is moved to xmm1 before the
other parameter gets evaluated.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 5963] iasm does not accept 64bit integer literal

2011-05-21 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5963


Walter Bright bugzi...@digitalmars.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||bugzi...@digitalmars.com
 Resolution||FIXED


--- Comment #1 from Walter Bright bugzi...@digitalmars.com 2011-05-21 
14:09:51 PDT ---
https://github.com/D-Programming-Language/dmd/commit/e4a4b33b279861c39e4c4f9bc90ef6686875d43b

https://github.com/D-Programming-Language/dmd/commit/ef2b5aa76ec49fca6d6f8a4cd3ad2f6488c1344a

https://github.com/D-Programming-Language/dmd/commit/af4204485c0ba4edd18807717bbc56e15447542f

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 6043] New: Chainable template mixin

2011-05-21 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6043

   Summary: Chainable template mixin
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: Phobos
AssignedTo: nob...@puremagic.com
ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2011-05-21 16:43:54 PDT ---
I suggest to add something like this to D2 Phobos (this is D1 code):

template Chainable() {
Chain!(typeof(this), Range) opCat(Range)(Range r) {
return chain(this, r);
}
}


Then in the body of a lazy range both Phobos ones like map, filter, zip, iota,
and so on, and user-defined ones, you may add:

mixin Chainable;


This allows to write more natural and readable code like:
iota(5) ~ filter!q{a}([1,0,3])
map!abs([1,2,-5]) ~ [10, 20]

instead of more noisy:
chain(iota(5), filter!q{a}([1,0,3]))
chain(map!abs([1,2,-5]), [10, 20])

See also bug 5638 for an useful optimization.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 5600] rdmd: Broken behavior with command-line input

2011-05-21 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5600


Nick Sabalausky cbkbbej...@mailinator.com changed:

   What|Removed |Added

 CC||cbkbbej...@mailinator.com


--- Comment #1 from Nick Sabalausky cbkbbej...@mailinator.com 2011-05-21 
17:13:40 PDT ---
This might be related to issue 4688

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---