www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Posix vs. Windows

reply "Mehrdad" <wfunction hotmail.com> writes:
 From looking at Phobos, I'm understanding that the main 
difference between the implementation of various features for 
Posix systems as compared to Windows systems (aside from the API, 
etc.) is that Windows tends to do a lot of stuff *before* the 
program is loaded (and hence requires special cases in a lot of 
places), whereas Posix systems tend to require you to call 
initializers manually (and hence they're called just like any 
other function).


Just wanted to check, is this understanding correct?

(The reasoning being, if I'm writing my own little kernel, I want 
to figure out whether I should be compiling Phobos with Posix or 
with Windows, to minimize my headaches... although I should 
mention that, either way, I'm going to be developing on Windows, 
in PE format.)
May 17 2012
next sibling parent reply Sean Kelly <sean invisibleduck.org> writes:
On May 17, 2012, at 1:01 PM, Mehrdad wrote:

 =46rom looking at Phobos, I'm understanding that the main difference =
between the implementation of various features for Posix systems as = compared to Windows systems (aside from the API, etc.) is that Windows = tends to do a lot of stuff *before* the program is loaded (and hence = requires special cases in a lot of places), whereas Posix systems tend = to require you to call initializers manually (and hence they're called = just like any other function).
=20
 Just wanted to check, is this understanding correct?
I'd say that Windows tends to do more for you, while Posix provides = lower-level APIs to accomplish the same thing. So Posix offers more = control and is typically more robust as a result. There are a few = exceptions however, like SEH has proven to be far more capable than = signals for certain classes of error handling.
 (The reasoning being, if I'm writing my own little kernel, I want to =
figure out whether I should be compiling Phobos with Posix or with = Windows, to minimize my headaches... although I should mention that, = either way, I'm going to be developing on Windows, in PE format.) If you're targeting Windows then use Windows APIs, if Posix then Posix. = Windows does claim Posix support, but it's really pretty terrible and = Druntime doesn't have declarations for the Posix Windows interface = anyway.=
May 18 2012
parent reply "Mehrdad" <wfunction hotmail.com> writes:
On Friday, 18 May 2012 at 16:37:31 UTC, Sean Kelly wrote:
 I'd say that Windows tends to do more for you, while Posix 
 provides lower-level APIs to accomplish the same thing.  So 
 Posix offers more control and is typically more robust as a 
 result.  There are a few exceptions however, like SEH has 
 proven to be far more capable than signals for certain classes 
 of error handling.

 If you're targeting Windows then use Windows APIs, if Posix 
 then Posix.  Windows does claim Posix support, but it's really 
 pretty terrible and Druntime doesn't have declarations for the 
 Posix Windows interface anyway.
Yeah... The reason I asked was, I ended up calling a bunch of stuff manually (e.g. rt_moduleCtor), and when I looked at Phobos, I realized that's exactly what the Posix code already does. So I was thinking if I used Phobos with the Posix flag, it might be easier, but probably not...
May 18 2012
parent Sean Kelly <sean invisibleduck.org> writes:
On May 18, 2012, at 9:50 AM, "Mehrdad" <wfunction hotmail.com> wrote:

 On Friday, 18 May 2012 at 16:37:31 UTC, Sean Kelly wrote:
 I'd say that Windows tends to do more for you, while Posix provides lower=
-level APIs to accomplish the same thing. So Posix offers more control and i= s typically more robust as a result. There are a few exceptions however, li= ke SEH has proven to be far more capable than signals for certain classes of= error handling.
=20
 If you're targeting Windows then use Windows APIs, if Posix then Posix.  W=
indows does claim Posix support, but it's really pretty terrible and Druntim= e doesn't have declarations for the Posix Windows interface anyway.
=20
 Yeah...
=20
 The reason I asked was, I ended up calling a bunch of stuff manually (e.g.=
rt_moduleCtor), and when I looked at Phobos, I realized that's exactly what= the Posix code already does. So I was thinking if I used Phobos with the Po= six flag, it might be easier, but probably not... The Windows code should do the same thing as far as runtime initialization i= s concerned.=20=
May 18 2012
prev sibling next sibling parent reply "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Fri, May 18, 2012 at 09:37:23AM -0700, Sean Kelly wrote:
[...]
 If you're targeting Windows then use Windows APIs, if Posix then
 Posix.  Windows does claim Posix support, but it's really pretty
 terrible and Druntime doesn't have declarations for the Posix Windows
 interface anyway.
Does Windows conform to the Posix spec at all? I highly doubt it, esp. some parts that just goes against how Windows works. T -- Question authority. Don't ask why, just do it.
May 18 2012
next sibling parent reply =?ISO-8859-1?Q?Alex_R=F8nne_Petersen?= <alex lycus.org> writes:
On 18-05-2012 18:42, H. S. Teoh wrote:
 On Fri, May 18, 2012 at 09:37:23AM -0700, Sean Kelly wrote:
 [...]
 If you're targeting Windows then use Windows APIs, if Posix then
 Posix.  Windows does claim Posix support, but it's really pretty
 terrible and Druntime doesn't have declarations for the Posix Windows
 interface anyway.
Does Windows conform to the Posix spec at all? I highly doubt it, esp. some parts that just goes against how Windows works. T
Try doing fork() on Windows. ;) -- Alex Rønne Petersen alex lycus.org http://lycus.org
May 18 2012
next sibling parent "Mehrdad" <wfunction hotmail.com> writes:
On Friday, 18 May 2012 at 16:53:54 UTC, Alex Rønne Petersen 
wrote:
 On 18-05-2012 18:42, H. S. Teoh wrote:
 On Fri, May 18, 2012 at 09:37:23AM -0700, Sean Kelly wrote:
 [...]
 If you're targeting Windows then use Windows APIs, if Posix 
 then
 Posix.  Windows does claim Posix support, but it's really 
 pretty
 terrible and Druntime doesn't have declarations for the Posix 
 Windows
 interface anyway.
Does Windows conform to the Posix spec at all? I highly doubt it, esp. some parts that just goes against how Windows works. T
Try doing fork() on Windows. ;)
I believe Interix (i.e. Windows POSIX subsystem) handles it perfectly well, although that's not at all related to what I was asking about haha.
May 18 2012
prev sibling parent reply Paulo Pinto <pjmlp progtools.org> writes:
Am 18.05.2012 18:53, schrieb Alex Rønne Petersen:
 On 18-05-2012 18:42, H. S. Teoh wrote:
 On Fri, May 18, 2012 at 09:37:23AM -0700, Sean Kelly wrote:
 [...]
 If you're targeting Windows then use Windows APIs, if Posix then
 Posix. Windows does claim Posix support, but it's really pretty
 terrible and Druntime doesn't have declarations for the Posix Windows
 interface anyway.
Does Windows conform to the Posix spec at all? I highly doubt it, esp. some parts that just goes against how Windows works. T
Try doing fork() on Windows. ;)
Easy, Initially Windows NT family only supported POSIX.1, due to US federal requirements, later on it was improved by Interix und SUA http://en.wikipedia.org/wiki/Microsoft_POSIX_subsystem More information here, http://technet.microsoft.com/en-us/library/cc772343 fork() ==> http://technet.microsoft.com/en-us/library/cc754234 -- Paulo
May 18 2012
parent reply =?ISO-8859-1?Q?Alex_R=F8nne_Petersen?= <alex lycus.org> writes:
On 18-05-2012 20:53, Paulo Pinto wrote:
 Am 18.05.2012 18:53, schrieb Alex Rønne Petersen:
 On 18-05-2012 18:42, H. S. Teoh wrote:
 On Fri, May 18, 2012 at 09:37:23AM -0700, Sean Kelly wrote:
 [...]
 If you're targeting Windows then use Windows APIs, if Posix then
 Posix. Windows does claim Posix support, but it's really pretty
 terrible and Druntime doesn't have declarations for the Posix Windows
 interface anyway.
Does Windows conform to the Posix spec at all? I highly doubt it, esp. some parts that just goes against how Windows works. T
Try doing fork() on Windows. ;)
Easy, Initially Windows NT family only supported POSIX.1, due to US federal requirements, later on it was improved by Interix und SUA http://en.wikipedia.org/wiki/Microsoft_POSIX_subsystem More information here, http://technet.microsoft.com/en-us/library/cc772343 fork() ==> http://technet.microsoft.com/en-us/library/cc754234 -- Paulo
Right, but that's not really Win32 out of the box. Cygwin implemented it too, in user land. -- Alex Rønne Petersen alex lycus.org http://lycus.org
May 18 2012
parent Paulo Pinto <pjmlp progtools.org> writes:
Am 18.05.2012 20:59, schrieb Alex Rønne Petersen:
 On 18-05-2012 20:53, Paulo Pinto wrote:
 Am 18.05.2012 18:53, schrieb Alex Rønne Petersen:
 On 18-05-2012 18:42, H. S. Teoh wrote:
 On Fri, May 18, 2012 at 09:37:23AM -0700, Sean Kelly wrote:
 [...]
 If you're targeting Windows then use Windows APIs, if Posix then
 Posix. Windows does claim Posix support, but it's really pretty
 terrible and Druntime doesn't have declarations for the Posix Windows
 interface anyway.
Does Windows conform to the Posix spec at all? I highly doubt it, esp. some parts that just goes against how Windows works. T
Try doing fork() on Windows. ;)
Easy, Initially Windows NT family only supported POSIX.1, due to US federal requirements, later on it was improved by Interix und SUA http://en.wikipedia.org/wiki/Microsoft_POSIX_subsystem More information here, http://technet.microsoft.com/en-us/library/cc772343 fork() ==> http://technet.microsoft.com/en-us/library/cc754234 -- Paulo
Right, but that's not really Win32 out of the box. Cygwin implemented it too, in user land.
Of course it is not Win32. Windows has the capability of multiple subsystems. By default 3 were offered in the beginnig: Win32, OS/2, Posix. OS/2 is no longer available for obvious reasons. The Posix is only one tick box away to install in any enterprise version, or via SUA to the home versions. Some of the APIs are implemented at kernel level, page 53, http://technet.microsoft.com/en-us/sysinternals/bb963901.aspx -- Paulo
May 18 2012
prev sibling parent reply "Adam Wilson" <flyboynw gmail.com> writes:
On Fri, 18 May 2012 09:42:54 -0700, H. S. Teoh <hsteoh quickfur.ath.cx>  
wrote:

 On Fri, May 18, 2012 at 09:37:23AM -0700, Sean Kelly wrote:
 [...]
 If you're targeting Windows then use Windows APIs, if Posix then
 Posix.  Windows does claim Posix support, but it's really pretty
 terrible and Druntime doesn't have declarations for the Posix Windows
 interface anyway.
Does Windows conform to the Posix spec at all? I highly doubt it, esp. some parts that just goes against how Windows works. T
SUA is deprecated in Windows 8. -- Adam Wilson IRC: LightBender Project Coordinator The Horizon Project http://www.thehorizonproject.org/
May 18 2012
parent Paulo Pinto <pjmlp progtools.org> writes:
Am 18.05.2012 21:03, schrieb Adam Wilson:
 On Fri, 18 May 2012 09:42:54 -0700, H. S. Teoh <hsteoh quickfur.ath.cx>
 wrote:

 On Fri, May 18, 2012 at 09:37:23AM -0700, Sean Kelly wrote:
 [...]
 If you're targeting Windows then use Windows APIs, if Posix then
 Posix. Windows does claim Posix support, but it's really pretty
 terrible and Druntime doesn't have declarations for the Posix Windows
 interface anyway.
Does Windows conform to the Posix spec at all? I highly doubt it, esp. some parts that just goes against how Windows works. T
SUA is deprecated in Windows 8.
So is Win32, at least partially.
May 18 2012
prev sibling next sibling parent reply Sean Kelly <sean invisibleduck.org> writes:
On May 18, 2012, at 9:42 AM, "H. S. Teoh" <hsteoh quickfur.ath.cx> wrote:

 On Fri, May 18, 2012 at 09:37:23AM -0700, Sean Kelly wrote:
 [...]
 If you're targeting Windows then use Windows APIs, if Posix then
 Posix.  Windows does claim Posix support, but it's really pretty
 terrible and Druntime doesn't have declarations for the Posix Windows
 interface anyway.
=20 Does Windows conform to the Posix spec at all? I highly doubt it, esp. some parts that just goes against how Windows works.
It's called SUA these days and I believe is Posix compliant. The problem is m= ore that the Posix spec is so loose that Posix compliance alone doesn't mean= very much. Tons of stuff is isn't implemented or is implemented badly, and t= he command shell is just a train wreck.=20=
May 18 2012
parent Paulo Pinto <pjmlp progtools.org> writes:
Am 18.05.2012 21:11, schrieb Sean Kelly:
 On May 18, 2012, at 9:42 AM, "H. S. Teoh"<hsteoh quickfur.ath.cx>  wrote:

 On Fri, May 18, 2012 at 09:37:23AM -0700, Sean Kelly wrote:
 [...]
 If you're targeting Windows then use Windows APIs, if Posix then
 Posix.  Windows does claim Posix support, but it's really pretty
 terrible and Druntime doesn't have declarations for the Posix Windows
 interface anyway.
Does Windows conform to the Posix spec at all? I highly doubt it, esp. some parts that just goes against how Windows works.
It's called SUA these days and I believe is Posix compliant. The problem is more that the Posix spec is so loose that Posix compliance alone doesn't mean very much. Tons of stuff is isn't implemented or is implemented badly, and the command shell is just a train wreck.
Developing software for multiple comercial UNIX systems has its own share of pains.
May 18 2012
prev sibling parent reply "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Fri, May 18, 2012 at 12:11:33PM -0700, Sean Kelly wrote:
 On May 18, 2012, at 9:42 AM, "H. S. Teoh" <hsteoh quickfur.ath.cx> wrote:
 
 On Fri, May 18, 2012 at 09:37:23AM -0700, Sean Kelly wrote:
 [...]
 If you're targeting Windows then use Windows APIs, if Posix then
 Posix.  Windows does claim Posix support, but it's really pretty
 terrible and Druntime doesn't have declarations for the Posix Windows
 interface anyway.
Does Windows conform to the Posix spec at all? I highly doubt it, esp. some parts that just goes against how Windows works.
It's called SUA these days and I believe is Posix compliant. The problem is more that the Posix spec is so loose that Posix compliance alone doesn't mean very much. Tons of stuff is isn't implemented or is implemented badly, and the command shell is just a train wreck.
Command shells have always been a train wreck on Windows, as far as I can remember. I haven't used Windows in any serious way for more than a decade now, so I can't speak for later versions of Windows, but I suspect things haven't changed much. This is one of those things that makes Windows (l)users wonder how we Unix people can stand using the shell all day -- their idea of shell is the DOS prompt (a veritable train wreck of train wrecks). If only they knew what a *real* shell can do. ;-) T -- All problems are easy in retrospect.
May 18 2012
next sibling parent Simon <s.d.hammett gmail.com> writes:
On 18/05/2012 20:41, H. S. Teoh wrote:
 Command shells have always been a train wreck on Windows, as far as I
 can remember. I haven't used Windows in any serious way for more than a
 decade now, so I can't speak for later versions of Windows, but I
 suspect things haven't changed much.

 This is one of those things that makes Windows (l)users wonder how we
 Unix people can stand using the shell all day -- their idea of shell is
 the DOS prompt (a veritable train wreck of train wrecks). If only they
 knew what a *real* shell can do. ;-)


 T
Powershell is actually very good, despite some major WTFs when programming in it. It's massively better than bash programming for instance. -- My enormous talent is exceeded only by my outrageous laziness. http://www.ssTk.co.uk
May 18 2012
prev sibling parent reply "Mehrdad" <wfunction hotmail.com> writes:
On Friday, 18 May 2012 at 19:40:35 UTC, H. S. Teoh wrote:
 This is one of those things that makes Windows (l)users wonder 
 how we Unix people can stand using the shell all day -- their 
 idea of shell is the DOS prompt (a veritable train wreck of 
 train wrecks). If only they knew what a *real* shell can do. ;-)
Don't generalize. :P I'm a Windows user, but yes, I've used Linux.... and yes, the command prompt is indeed a train wreck. Bash is indeed a lot better. And no, I haven't used PowerShell; I hate programs that take too long to start up. I definitely know what a *real* shell can do, but I also know that it's *pretty damn hard* to write foolproof code in Bash. Just look at: http://mywiki.wooledge.org/BashPitfalls It's just that in Bash scripts, it's easier to get to 99% correctness than it is with batch files. But getting to 100% is a pain in *BOTH* (indeed, I still have no idea how to do it). On the other hand, I *do* wonder how CLI users get any work done without the ability to do GUI-related tasks (e.g. refactoring in Visual Studio/Eclipse/whatever?). :P
May 18 2012
next sibling parent "Mehrdad" <wfunction hotmail.com> writes:
On Friday, 18 May 2012 at 21:08:28 UTC, Mehrdad wrote:
 On the other hand, I *do* wonder how CLI users get any work 
 done without the ability to do GUI-related tasks (e.g. 
 refactoring in Visual Studio/Eclipse/whatever?). :P
Er, I should have said "GUI-aided" instead of "GUI-related"... It's just that I haven't seen a *single* CLI tool offer the same powerful features as a GUI tool like refactoring. Of course, GUI-related tools (Photoshop? Office suites? Web browsing? etc.) are out of the question anyway
May 18 2012
prev sibling parent reply "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Fri, May 18, 2012 at 11:08:26PM +0200, Mehrdad wrote:
 On Friday, 18 May 2012 at 19:40:35 UTC, H. S. Teoh wrote:
This is one of those things that makes Windows (l)users wonder how we
Unix people can stand using the shell all day -- their idea of shell
is the DOS prompt (a veritable train wreck of train wrecks).  If only
they knew what a *real* shell can do. ;-)
Don't generalize. :P
Well, that was partially tongue-in-cheek. ;-)
 I'm a Windows user, but yes, I've used Linux.... and yes, the command
 prompt is indeed a train wreck. Bash is indeed a lot better.
 
 And no, I haven't used PowerShell; I hate programs that take too long
 to start up.
Whoa. PowerShell takes a long time to start up? Sounds like it's already a train wreck even before you start using it.
 I definitely know what a *real* shell can do, but I also know that
 it's *pretty damn hard* to write foolproof code in Bash.
 Just look at: http://mywiki.wooledge.org/BashPitfalls
OK, _using_ bash and _coding_ in bash are two very different things. I routinely write complex 1-liners to do crazy complex stuff in ways that no GUI can express. *But* I also never write bash scripts. Well, OK, that's a lie... I do, but never more than 1-liners, or just very simple sequences of commands. Because you're right: bash is good for interactive use, but it's ... shall we say, completely atrocious for scripting? Like the stupid implicit interpolation everywhere (and sometimes _inconsistent_ levels of interpolation -- well OK, it's actually consistent, but not to someone who can't recite bash code in their dreams), that causes leaning toothpick syndrome galore. For scripting, you want Perl, not bash. And just for the record, I was a tcsh user for well over a decade before I decided to use bash, 'cos tcsh also has its own suckage.
 It's just that in Bash scripts, it's easier to get to 99% correctness
 than it is with batch files. But getting to 100% is a pain in *BOTH*
 (indeed, I still have no idea how to do it).
Use Perl. :-) And batch files... yikes. The incompleteness and quirkiness of them makes them almost completely unusable for anything but the most trivial of tasks. Bash scripts can do a lot more, but there are pitfalls, holes, and hidden interpolations everywhere that threaten to disintegrate your beautiful castle of cards if you feed it the wrong kind of data.
 On the other hand, I *do* wonder how CLI users get any work done
 without the ability to do GUI-related tasks (e.g. refactoring in
 Visual Studio/Eclipse/whatever?). :P
I find IDEs more painful to use than scratching your nails on a chalkboard. The inability of running an IDE over a remote SSH session without everything slowing down to a snail crawl makes it completely unusable for me. In the amount of time it takes the beast to paint the screen, I could've manually refactored the code three times over. The use of a _real_ text editor (i.e., NOT that monstrous shipwreck of an excuse for software called notepad, or its dainbramaged second cousin wordpad) helps a lot. Like, one that can filter an arbitrary text selection through an arbitrary-complex shell command. :-) Or that can repeatedly apply a complex sequence of editing commands at a single keystroke (as opposed to navigating the rodent through endless layers of menus). But I won't start the Visual Irritation vs. Extremely Massive And Cumbersome System flamewar here. ;-) T -- "How are you doing?" "Doing what?"
May 18 2012
next sibling parent reply "Mehrdad" <wfunction hotmail.com> writes:
On Friday, 18 May 2012 at 23:02:18 UTC, H. S. Teoh wrote:

 I find IDEs more painful to use than scratching your nails on a 
 chalkboard. The inability of running an IDE over a remote SSH 
 session without everything slowing down to a snail crawl makes 
 it completely unusable for me.
Have you tried running Eclipse/Visual Studio over Remote Desktop on Windows? Was it actually that slow?
 In the amount of time it takes the beast to paint the screen, I 
 could've manually refactored the code three times over.
I don't think refactoring means what you think it means. xP Ever tried "Rename all references"? It's impossible to do correctly without IDE support, unless all your variable names are unique (idk about you, but I've never seen a project like that). identifier, type in the new name, Ctrl-Dot, and press Enter. (Probably similar with Eclipse.) Literally, it takes 1-2 extra seconds, and it renames across your entire project. I have *never* seen a text-based tool do this -- if you know of any, let me know!
 The use of a _real_ text editor
I use SciTE, with a handful of tweaks to the source code (not big, just small changes). It works on Linux as well, and it's amazing. (Not quite as powerful as Emacs/Vim, but it's hella more intuitive/easier to use, so worth it IMO.)
 (i.e., NOT that monstrous shipwreck of an excuse for software 
 called notepad, or its dainbramaged second cousin wordpad)
LOL those are "editors"? I just thought they were 'pads'...
 Like, one that can filter an arbitrary text selection through 
 an arbitrary-complex shell command.
 Or that can repeatedly apply a complex sequence of editing 
 commands at a single keystroke (as opposed to navigating the 
 rodent through endless layers of menus).
Ever used macros in Visual Studio? (There might exist the same thing for Eclipse, idk.) No? Well, it does what you're saying. In a more powerful way than you're saying. :P
 But I won't start the Visual Irritation vs. Extremely Massive 
 And Cumbersome System flamewar here. ;-)
...oops
May 18 2012
parent reply "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Sat, May 19, 2012 at 01:21:56AM +0200, Mehrdad wrote:
 On Friday, 18 May 2012 at 23:02:18 UTC, H. S. Teoh wrote:
 
I find IDEs more painful to use than scratching your nails on a
chalkboard. The inability of running an IDE over a remote SSH
session without everything slowing down to a snail crawl makes it
completely unusable for me.
Have you tried running Eclipse/Visual Studio over Remote Desktop on Windows?
I don't use Windows except when I have to fix my wife's windows laptop. :-P
 Was it actually that slow?
Anything that has a GUI is unacceptably slow over a remote connection, last time I checked. I'm not talking about connecting over a local network, which doesn't really count, but a connection over the internet.
In the amount of time it takes the beast to paint the screen, I
could've manually refactored the code three times over.
I don't think refactoring means what you think it means. xP Ever tried "Rename all references"? It's impossible to do correctly without IDE support, unless all your variable names are unique (idk about you, but I've never seen a project like that).
Strange, last I checked, global variables aren't a good coding practice. :-) Renaming local variables is a trivial search-n-replace. But you're right that certain renamings, like a member function name that may be overloaded across a large number of classes, could potentially be very painful. Though what I'd really like in that case is a syntax-tree aware text editor. Or a nice console-based IDE that isn't dependent upon a GUI. [...]
The use of a _real_ text editor
I use SciTE, with a handful of tweaks to the source code (not big, just small changes). It works on Linux as well, and it's amazing. (Not quite as powerful as Emacs/Vim, but it's hella more intuitive/easier to use, so worth it IMO.)
"Intuitive" text editors are ultimately also limited by their intuitiveness, because what most people think of as "intuitive" is "what I type appears on the screen" and "I don't have to memorize obscure key sequences to get stuff done". What you really need are _logical_ operations, like "navigate to the word 'void'", "go down 3 paragraphs", "go to the start of this block", "replace text up to the next matching delimiter", "select the function body", "line-wrap the selected text", etc..
(i.e., NOT that monstrous shipwreck of an excuse for software called
notepad, or its dainbramaged second cousin wordpad)
LOL those are "editors"? I just thought they were 'pads'...
They aren't real editors, no, but a lot people seem to think they are.
Like, one that can filter an arbitrary text selection through an
arbitrary-complex shell command.  Or that can repeatedly apply a
complex sequence of editing commands at a single keystroke (as
opposed to navigating the rodent through endless layers of menus).
Ever used macros in Visual Studio? (There might exist the same thing for Eclipse, idk.)
I'm not talking about having to click through 5 menus and type in a macro definition, bind it to some keystroke, and then run it afterwards. I'm talking about things like "search for this regex and replace it with that pattern, now do this again to the next 25 occurrences of the search term" -- ON THE FLY. I don't care to waste time defining a whole named macro just for this one occasion. I want to, in essence, write 1-line code to transform the current selection, right now.
 No?
 
 Well, it does what you're saying.
 In a more powerful way than you're saying. :P
Then please enlighten me with an example. :-)
But I won't start the Visual Irritation vs. Extremely Massive And
Cumbersome System flamewar here. ;-)
...oops
By which I mean VI vs. EMACS, of course. ;-) T -- In theory, there is no difference between theory and practice.
May 18 2012
next sibling parent reply "Mehrdad" <wfunction hotmail.com> writes:
On Friday, 18 May 2012 at 23:50:18 UTC, H. S. Teoh wrote:
 Was it actually that slow?
Anything that has a GUI is unacceptably slow over a remote connection, last time I checked. I'm not talking about connecting over a local network, which doesn't really count, but a connection over the internet.
Uhm, no. The *slowest* GUI's I've seen are -- by far -- SSH-based. (e.g. remote Emacs -- even on a local network -- is horrible.) I've _personally_ used National Instruments's tools over cable internet (if you've used them, you know they're certainly *not* less GUI-intensive than an IDE lol), and they're completely usable. Not /fast/, mind you -- but completely acceptable. And no, my cable wasn't fantastic either. And yes, it was plain old Remote Desktop. Also, the other side's server was kinda slow too. You should definitely try it. :P
 Strange, last I checked, global variables aren't a good coding 
 practice. :-) Renaming local variables is a trivial 
 search-n-replace.
lol ok you got me there
 But you're right that certain renamings, like a member function 
 name that may be overloaded across a large number of classes, 
 could potentially be very painful.
Yeah, imagine trying to name a method named "getValue()" to something else (probably because you realized that's not a great name :P). A HUGE time waster without refactoring tools, and last time I checked, no text-based tool did it.
 Though what I'd really like in that case is a syntax-tree aware 
 text editor.
100% agree, I've been looking for them too. But they don't exist. And practically speaking, without project management (in which case they'd be half-baked IDEs), the *can't* exist...
 Or a nice console-based IDE that isn't dependent upon a GUI.
, I'd probably use them too, but they don't exist AFAIK. :(
 "Intuitive" text editors are ultimately also limited by their 
 intuitiveness, because what most people think of as "intuitive" 
 is "what I type appears on the screen" and "I don't have to 
 memorize obscure key sequences to get stuff done". What you 
 really need are _logical_ operations, like "navigate to the 
 word 'void'", "go down 3 paragraphs", "go to the start of this 
 block", "replace text up to the next matching delimiter", 
 "select the function body", "line-wrap the selected text", etc..
 They aren't real editors, no, but a lot people seem to think 
 they are.
lol. Those people probably haven't used Linux either. :P
 I'm not talking about having to click through 5 menus and type 
 in a macro definition, bind it to some keystroke, and then run 
 it afterwards. I'm talking about things like "search for this 
 regex and replace it with that pattern, now do this again to 
 the next 25 occurrences of the search term" -- ON THE FLY.
Oh, I misunderstood then. In that case, you don't even need an external tool... Ctrl-H: Brings up Replace dialog. Alt-E: Check the "Regex" box. Alt-P: Type in the regex. <types regex> Alt-R: However many times you want, to replace the next instance. Though I'd question what you were doing if it were 25 times. Most likely you want to do it within a certain range of the document, in which case you can highlight that portion of the text (with the keyboard or the mouse, both are easy :P), and just tell your editor/IDE to replace only that portion. Both are a piece of cake, and neither needs an external tool.
 I don't care to waste time defining a whole named macro just 
 for this one occasion. I want to, in essence, write 1-line code 
 to transform the current selection, right now.
Yes, writing 1-line code is definitely easier in *nix-based tools (since they're text based, obviously), but if you have any other examples of actual tasks you do regularly, let me know -- I'm sure there's a way to do them with VS/Eclipse that isn't much different in terms of the amount of work/payoff.
 Well, it does what you're saying.
 In a more powerful way than you're saying. :P
Then please enlighten me with an example. :-)
They give you access to the *entire IDE* and *all APIs whatsoever*, so "give me an example" results in "pretty much anything you want" -- minus the syntax tree, unfortunately (not sure why). But if you need an example... I've made a macro to look for all of my C++ include and library directories, and switch them from Visual Studio to Windows WDK (for various reasns). Oh, and to detect where the WDK is, I read the registry keys inside the macro, find the directories, etc.. Easy. And *none* of the pain with escaping quotes or whatnot, since it's an actual *language* (VB.NET, which has nothing to do with VB6, btw -- just Oh, and it supports different versions of the WDK. All in about ~150-200 lines of VB.NET code, and I've used it a few dozens of times now. Saved my fingers from all the typing I'd otherwise have to do to change a gazillion project settings. And I don't have to interface with any text lol. If you were to do this with some text-based tool, it'd be next to impossible IMO, since you'd have to edit XML settings, and keep track of all the repetitions (e.g. something might appear under a Debug node but not a Release node, etc.).
 By which I mean VI vs. EMACS, of course. ;-)
Ah lol. I hate both. XD
May 18 2012
next sibling parent reply "Mehrdad" <wfunction hotmail.com> writes:
On Saturday, 19 May 2012 at 00:39:22 UTC, Mehrdad wrote:
 If you were to do this with some text-based tool, it'd be next 
 to impossible IMO, since you'd have to edit XML settings, and 
 keep track of all the repetitions (e.g. something might appear 
 under a Debug node but not a Release node, etc.).
Btw: The "correct" way to do what I intended was to use Property Sheets, which are meant to be 'templates' for project settings. Obviously, a lot easier than writing a macro -- just set the settings by hand once, and merge them with your projects later. (Pretty sure your CLI tool doesn't have that either. :P) But I didn't know about them beforehand...
May 18 2012
parent reply "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Sat, May 19, 2012 at 02:45:00AM +0200, Mehrdad wrote:
 On Saturday, 19 May 2012 at 00:39:22 UTC, Mehrdad wrote:
If you were to do this with some text-based tool, it'd be next to
impossible IMO, since you'd have to edit XML settings, and keep
track of all the repetitions (e.g. something might appear under a
Debug node but not a Release node, etc.).
Btw: The "correct" way to do what I intended was to use Property Sheets, which are meant to be 'templates' for project settings. Obviously, a lot easier than writing a macro -- just set the settings by hand once, and merge them with your projects later. (Pretty sure your CLI tool doesn't have that either. :P)
[...] That just went way over my head. Why do you need to use some fancy feature with some fancy name just for changing some settings? But over the years, I've become convinced that anything worth doing can always be done at the command-line, faster, and with much more flexibility. But then again, I *am* a command-line freak... y'know, to a hammer, every problem is a nail, etc.. :-) Most programs that require elaborate non-text configuration formats also tend to be bloated GUI-bound mammoths that aren't really in my consideration anyway, so *shrug*. T -- LINUX = Lousy Interface for Nefarious Unix Xenophobes.
May 18 2012
parent "Mehrdad" <wfunction hotmail.com> writes:
On Saturday, 19 May 2012 at 01:33:34 UTC, H. S. Teoh wrote:
 [...]

 That just went way over my head. Why do you need to use some 
 fancy feature with some fancy name just for changing some 
 settings?

 But over the years, I've become convinced that anything worth 
 doing can always be done at the command-line, faster, and with 
 much more flexibility. But then again, I *am* a command-line 
 freak... y'know, to a hammer, every problem is a nail, etc.. 
 :-) Most programs that require elaborate non-text configuration 
 formats also tend to be bloated GUI-bound mammoths that aren't 
 really in my consideration anyway, so *shrug*.


 T
Haha, fair enough.
May 18 2012
prev sibling next sibling parent reply "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Sat, May 19, 2012 at 02:39:20AM +0200, Mehrdad wrote:
 On Friday, 18 May 2012 at 23:50:18 UTC, H. S. Teoh wrote:
Was it actually that slow?
Anything that has a GUI is unacceptably slow over a remote connection, last time I checked. I'm not talking about connecting over a local network, which doesn't really count, but a connection over the internet.
Uhm, no. The *slowest* GUI's I've seen are -- by far -- SSH-based. (e.g. remote Emacs -- even on a local network -- is horrible.)
You must be using Emacs with a GUI.
 I've _personally_ used National Instruments's tools over cable
 internet (if you've used them, you know they're certainly *not* less
 GUI-intensive than an IDE lol), and they're completely usable. Not
 /fast/, mind you -- but completely acceptable.
GUI-intensive apps aren't even on my radar. I don't do GUI. I'm a command-line freak. The only GUI I consistently use is the browser, which I only use for nice embedded image support and the fact that nowadays, almost every website is graphic-intensive and specifically designed to be as painful to use as possible should you ever dare to turn off images.
 And no, my cable wasn't fantastic either.
 And yes, it was plain old Remote Desktop.
 Also, the other side's server was kinda slow too.
 
 You should definitely try it. :P
I regularly do all sorts of stuff over SSH. And I don't mean SSH tunnelling that crap called X11, I mean good ole pure text-only SSH. As soon as anything with graphics factor into the equation, it turns into a crawling morass of slowness. Which is what I mean. GUI's are useless across an SSH connection. [...]
But you're right that certain renamings, like a member function
name that may be overloaded across a large number of classes,
could potentially be very painful.
Yeah, imagine trying to name a method named "getValue()" to something else (probably because you realized that's not a great name :P).
Although I'd argue that somebody silly enough to actually design an API with methods called "getValue" deserves the pain of manually renaming every instance of it. :-P
 A HUGE time waster without refactoring tools, and last time I
 checked, no text-based tool did it.
Oh? It's called "rename the method and recompile, get 50 pages of compile errors, pipe it to a grep command that extracts the filenames and line numbers, use sed to transform that into a sed command that automatically substitutes every instance of the matching identifier on the given files/line numbers". See, I told you I was a command-line freak. :-) You can't do that in any GUI app that wasn't specifically designed to handle that specific operation. It's all fine and dandy when it *does* happen to support that exact operation that you need, but good luck when the app writers didn't think of this one case that you just ran into. Which I just did with basic tools designed 20+ years ago (probably longer). :-P
Though what I'd really like in that case is a syntax-tree aware text
editor.
100% agree, I've been looking for them too. But they don't exist. And practically speaking, without project management (in which case they'd be half-baked IDEs), the *can't* exist...
Well, I _did_ demonstrate how to do it above, given the proper tools and shell support. :-) It's a bit clunky, but hey, it works. And if you get further compile errors, just look those up (using suitable combinations of grep/sed) and undo the wrong substitutions. Just two steps, and you're done.
Or a nice console-based IDE that isn't dependent upon a GUI.
, I'd probably use them too, but they don't exist AFAIK. :(
My IDE is called vim. :-P *runs and hides* [...]
I'm not talking about having to click through 5 menus and type in
a macro definition, bind it to some keystroke, and then run it
afterwards. I'm talking about things like "search for this regex
and replace it with that pattern, now do this again to the next 25
occurrences of the search term" -- ON THE FLY.
Oh, I misunderstood then. In that case, you don't even need an external tool... Ctrl-H: Brings up Replace dialog. Alt-E: Check the "Regex" box. Alt-P: Type in the regex. <types regex> Alt-R: However many times you want, to replace the next instance.
You're missing the point. My point was that you can do this with *arbitrarily complex sequences of operations*. Yes search and replace with regex is a specific command that's supported by your IDE, but what about "move one line down, one word over, increment the number by 1" repeated 50 times to repair a table of numbers that had some miscalculations"? In vim, you can group such sequences of operations and apply them repeatedly. The fact that the operations are logical (move one word over instead of move 5 characters over, which may not work if your code has varying word lengths) helps a lot.
 Though I'd question what you were doing if it were 25 times. Most
 likely you want to do it within a certain range of the document, in
 which case you can highlight that portion of the text (with the
 keyboard or the mouse, both are easy :P), and just tell your
 editor/IDE to replace only that portion.
It was just for illustrative purposes. It doesn't have to be "repeat n times"; what about "apply operation X,Y,Z until the end of the enclosing block"? [...]
I don't care to waste time defining a whole named macro just for this
one occasion. I want to, in essence, write 1-line code to transform
the current selection, right now.
Yes, writing 1-line code is definitely easier in *nix-based tools (since they're text based, obviously), but if you have any other examples of actual tasks you do regularly, let me know -- I'm sure there's a way to do them with VS/Eclipse that isn't much different in terms of the amount of work/payoff.
Like I said, I do all sorts of insane stuff all the time. And not just with code, I regularly edit code, documentation, script files, data files, etc., in the same vim session. It sucks to have to open 15 different apps and waste time switching between them when I could do everything without my fingers leaving the keyboard for 1 second (and without focus-distracting cycling through windows). [...]
 I've made a macro to look for all of my C++ include and library
 directories, and switch them from Visual Studio to Windows WDK (for
 various reasns).
 Oh, and to detect where the WDK is, I read the registry keys inside
 the macro, find the directories, etc.. Easy. And *none* of the pain
 with escaping quotes or whatnot, since it's an actual *language*

 different syntax), not a Bash script.
Bash scripts suck. We've established that. :-) Your example went over my head, 'cos I haven't used windows in any serious way for at least 15 years. :-P [...]
 All in about ~150-200 lines of VB.NET code, and I've used it a few
 dozens of times now. Saved my fingers from all the typing I'd
 otherwise have to do to change a gazillion project settings.
Stop right there. Project settings, eh? lol... I remember that one term when I was TA in an introductory Java course (way back in the day), and we had to use VisualAge Java. Let's just say that I'm glad _I'm_ not one of the students. :-P For me, an SConscript does my project management way better than any IDE project settings could ever do. And, being actually written in Python, I can write arbitrarily complex code for switching between compilers, libraries, operating systems, whatever, and just specify one or two command-line parameters, and the whole thing builds like magic. In fact, SCons rulez so much that I build an _website_ with it, starting with source code that produce numerical programs that output data that gets turned into POVRay scenes, which gets rendered into images that are installed to the website. Then there are static php files that get piped through php-cli and installed as .html files. There's also a particular image that's generated by scanning a Subversion log, filtering into a dataset that gets graphed by gnuplot, and then the image is installed to the website. And some sample source code that automatically gets tarballed. All of this is done with a single SCons command -- change a single file, and it automatically figures out everything that has to be updated (e.g., update the tarball), and leaves everything else untouched. Now try writing an IDE that can do all of _that_ in one go. :-P
 And I don't have to interface with any text lol.
 
 If you were to do this with some text-based tool, it'd be next to
 impossible IMO, since you'd have to edit XML settings, and keep
 track of all the repetitions (e.g. something might appear under a
 Debug node but not a Release node, etc.).
XML is the spawn of evil, next in evilness only to Javascript, but I digress. :-P Seriously though, you could just use xmlstar (google for it) if you really have to. XML is not meant for human consumption. Only machines can process that horribly tedious stuff without its brain turning into a pretzel.
By which I mean VI vs. EMACS, of course. ;-)
Ah lol. I hate both. XD
You don't know what you're missing. No, really. Trust me, I know, because I used to hate them too. I hated them so much, that I wrote (well, tried to write) my own editor just so that I didn't have to use them, when pico just didn't cut it anymore for doing serious work. And then my supervisor at my first job made me learn vim. Which made me hate it all the more. Until one day, after investing lots of time (and venting lots of frustration) into learning how to use it properly, it suddenly all *clicked*. Since then, I've never looked back. Now in retrospect (har har), all those other "editors" that I loved were actually just backbiting cripples that wasn't worth a pinch of my dedication to them. Try it sometime. You might find yourself liking what you thought was impossible not to hate, ever. :-) T -- In a world without fences, who needs Windows and Gates? -- Christian Surchi
May 18 2012
parent reply "Mehrdad" <wfunction hotmail.com> writes:
On Saturday, 19 May 2012 at 01:28:32 UTC, H. S. Teoh wrote:
 You must be using Emacs with a GUI.
No, I told you I hate Emacs. :P I've seen *other* people do it, and it's horribly slow.
 GUI-intensive apps aren't even on my radar. I don't do GUI.
okay... maybe National Instruments's LabView wasn't a good example for when we're talking about programming lol.
 Which is what I mean. GUI's are useless across an SSH 
 connection.
Ah, ok. That makes more sense than "GUIs are slow over an internet connection". Yes, SSH wasn't designed for GUIs (or the converse), so of course it's slow. Trying to force GUIs onto *nix systems is like trying to force a command-line tool on Windows... doesn't exactly work the way it's supposed to, and it gives you the wrong impression.
 Although I'd argue that somebody silly enough to actually 
 design an API with methods called "getValue" deserves the pain 
 of manually renaming every instance of it. :-P
LOL How about "payload", where have I seen that before? lol
 Oh? It's called "rename the method and recompile, get 50 pages 
 of
 compile errors, pipe it to a grep command that extracts the 
 filenames and line numbers, use sed to transform that into a 
 sed command that automatically substitutes every instance of 
 the matching identifier on the given files/line numbers".

 See, I told you I was a command-line freak. :-)
Yes, that's clever. :P **EXCEPT**: 1. Compilers (cough, DMD?) generally limit their output to a few dozen errors, so your '50 pages' is kinda off. :P But yea, you could just loop until it works. 2. Okay, so that's clever. :P Now tell me what you do when you have dozens of lines in your source file like property auto length() { return _range.length; } and you want to rename the field 'length'? How do you prevent the second one from getting renamed? Or say you have property auto back() { ... } property moveBack() { assert(0, "Cannot move an element from the back!"); } auto popBack() { } // Remove an element from the back and you change the name of the property 'back' to 'last': property auto back() { ... } property moveBack() { assert(0, "Cannot move an element from the last!"); } auto popBack() { } // Remove an element from the last Notice something funny? Worse yet, no way in hell that a command-line tool would tell you your documentation is messed up. :P
 Well, I _did_ demonstrate how to do it above, given the proper 
 tools and shell support. :-) It's a bit clunky, but hey, it 
 works. And if you get further compile errors, just look those 
 up (using suitable combinations of grep/sed) and undo the wrong 
 substitutions. Just two steps, and you're done.
You're done? Or so you think. See above.
 My IDE is called vim. :-P *runs and hides*
Better than Emacs loll :-P *also runs and hides*
 You're missing the point. My point was that you can do this 
 with *arbitrarily complex sequences of operations*. Yes search 
 and replace with regex is a specific command that's supported 
 by your IDE, but what about "move one line down, one word over, 
 increment the number by 1 repeated 50 times to repair a table 
 of numbers that had some miscalculations"?
Visual Studio has a "Record Macro" feature, to record keystrokes and such, but I haven't used it, so I don't know if it does what you want -- but yeah, if it doesn't, I can see why you'd choose Vim/Emacs/whatever.
 It was just for illustrative purposes. It doesn't have to be 
 "repeat n times"; what about "apply operation X,Y,Z until the 
 end of the enclosing block"?
Uhm, just highlight it and apply the operation to the highlighted block...
 It sucks to have to open 15 different apps and waste time 
 switching between them when I could do everything without my 
 fingers leaving the keyboard for 1 second (and without 
 focus-distracting cycling through windows).
My hands don't leave the keyboard too often either... even the basics Alt-Tab/Ctrl-Tab/F8/PageUp/PageDown/etc. get the job done fairly well, and the mnemonics (e.g. Alt-O to hit the button with "O" underlined) make it 10x better.
 Your example went over my head, 'cos I haven't used windows in 
 any serious way for at least 15 years. :-P
lol ok. If you get the chance sometime, might wanna give Windows 7 a try. :P Last time I used Linux was a few days ago (Ubuntu) so I guess I'd naturally have more to say about it haha.
 Stop right there. Project settings, eh? lol...
Better than configure.in/configure/makefile.in/makefile/all that crap. :P
 For me, an SConscript does my project management way better 
 than any IDE project settings could ever do.
 [...]
 Now try writing an IDE that can do all of _that_ in one go. :-P
I gotta use SCons, haven't used it before :)
 XML is the spawn of evil, next in evilness only to Javascript, 
 but I digress. :-P Seriously though, you could just use xmlstar 
 (google for it) if you really have to. XML is not meant for 
 human consumption. Only machines can process that horribly 
 tedious stuff without its brain turning into a pretzel.
Haha okay well if you claim the entire STACK of tools is evil then I guess I can't help you there lol.
 You don't know what you're missing.  No, really. Trust me, I 
 know, because I used to hate them too. I hated them so much, 
 that I wrote (well, tried to write) my own editor just so that 
 I didn't have to use them, when pico just didn't cut it anymore 
 for doing serious work.  And then my supervisor at my first job 
 made me learn vim. Which made me hate it all the more. Until 
 one day, after investing lots of time (and venting lots of 
 frustration) into learning how to use it properly, it suddenly 
 all *clicked*.
 Try it sometime. You might find yourself liking what you 
 thought was impossible not to hate, ever. :-)
Haha I definitely will. I actually never thought they were /bad/ (they're just hard to learn and unintuitive, and so I hate them) but I definitely agree, I could certainly give them another chance and perhaps like them. Will give them another try when I get the chance. :)
May 18 2012
next sibling parent reply "Mehrdad" <wfunction hotmail.com> writes:
On Saturday, 19 May 2012 at 02:10:31 UTC, Mehrdad wrote:
 Worse yet, no way in hell that a command-line tool would tell 
 you your documentation is messed up. :P
I should submit a correction: Nothing wrong with the command-line-ness per se -- it's just that command-line tools happen to be text-based, so when they just work with text, they miss the fact that it's documentation and not code. It's just that I haven't seen a command-line tool do refactoring like that. An IDE would obviously make the same mistake, if you used Search/Replace instead of actually doing refactoring.
May 18 2012
parent Paulo Pinto <pjmlp progtools.org> writes:
Am 19.05.2012 04:15, schrieb Mehrdad:
 On Saturday, 19 May 2012 at 02:10:31 UTC, Mehrdad wrote:
 Worse yet, no way in hell that a command-line tool would tell you your
 documentation is messed up. :P
I should submit a correction: Nothing wrong with the command-line-ness per se -- it's just that command-line tools happen to be text-based, so when they just work with text, they miss the fact that it's documentation and not code. It's just that I haven't seen a command-line tool do refactoring like that. An IDE would obviously make the same mistake, if you used Search/Replace instead of actually doing refactoring.
I used to be an Emacs fan, but the no Emacs plugins are able to deliver the set of tools any IDE offers. - visual code navigation, away better than cscope/ctags are able to offer - dependency analysis tools between modules - code refactoring - compile as you write - code completion with direct code documentation popups - method/classes information as popup - RAD tools for UI generation - Locate all usages of a given symbol, even across compiled modules - Show call sequences for a given method/function - Find using semantic information - Plugins repositories - Debugger integration, with possible edit and continue All of the above feature made me a fan of IDEs, since the MS-DOS days. You can do a lot of those features in Emacs or VIM, but they are all text based, and always feel like a poor man's solution, when you already experienced the IDE ones. -- Paulo
May 18 2012
prev sibling next sibling parent reply "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Sat, May 19, 2012 at 04:10:29AM +0200, Mehrdad wrote:
 On Saturday, 19 May 2012 at 01:28:32 UTC, H. S. Teoh wrote:
You must be using Emacs with a GUI.
No, I told you I hate Emacs. :P I've seen *other* people do it, and it's horribly slow.
Well, let's just say that Emacs and gui in a single sentence is just a recipe for pain. Especially when you're talking about doing it over the network. [...]
Which is what I mean. GUI's are useless across an SSH connection.
Ah, ok. That makes more sense than "GUIs are slow over an internet connection". Yes, SSH wasn't designed for GUIs (or the converse), so of course it's slow.
Although, to be fair, the reason for much of this slowness on *nix systems is that X11 is one phat protocol. Trying to to run X11 over a remote SSH session is like trying to parse a 5MB XML file on a 386 with 512k RAM instead of just reading the data directly from a binary file. It's just _asking_ for pain, and lots of it.
 Trying to force GUIs onto *nix systems is like trying to force a
 command-line tool on Windows... doesn't exactly work the way it's
 supposed to, and it gives you the wrong impression.
Well... I think a lot of it is that people are used to the way Windows work, and they imagine that _all_ GUIs must work just like that. Which is not true. On the flip side, X11 was designed in a bygone age, and its age is showing (and rather badly at that). It paid lots of attention to little trivial things that are no longer applicable in today's systems, and as a result performs poorly over the internet. There have been efforts to design a more modern windowing system, but none of them have caught on just yet. One day it's bound to happen, though. [...]
Oh? It's called "rename the method and recompile, get 50 pages of
compile errors, pipe it to a grep command that extracts the filenames
and line numbers, use sed to transform that into a sed command that
automatically substitutes every instance of the matching identifier
on the given files/line numbers".

See, I told you I was a command-line freak. :-)
Yes, that's clever. :P **EXCEPT**: 1. Compilers (cough, DMD?) generally limit their output to a few dozen errors, so your '50 pages' is kinda off. :P But yea, you could just loop until it works. 2. Okay, so that's clever. :P Now tell me what you do when you have dozens of lines in your source file like property auto length() { return _range.length; } and you want to rename the field 'length'? How do you prevent the second one from getting renamed?
Substitute "length(" with "size(" instead of just "length" with "size". Problem solved. :-)
 Or say you have
 
 	 property auto back() { ... }
 	 property moveBack() { assert(0, "Cannot move an element from the
 back!"); }
 	auto popBack() { }    // Remove an element from the back
 
 and you change the name of the property 'back' to 'last':
 
 	 property auto back() { ... }
 	 property moveBack() { assert(0, "Cannot move an element from the
 last!"); }
 	auto popBack() { }    // Remove an element from the last
 
 Notice something funny?
Again, you rename "back(" to "last(" instead of "back" to "last". This is a trivial mistake that anyone who's used vim for at least a year would've known without thinking twice. :-)
 Worse yet, no way in hell that a command-line tool would tell you your
 documentation is messed up. :P
Oh yeah? And what about when documentation mentions the old name of the method? In which case you *want* to rename it. :-)
Well, I _did_ demonstrate how to do it above, given the proper tools
and shell support. :-) It's a bit clunky, but hey, it works.  And if
you get further compile errors, just look those up (using suitable
combinations of grep/sed) and undo the wrong substitutions. Just two
steps, and you're done.
You're done? Or so you think. See above.
I did say it's clunky. But it's also a trivial case that one quickly learns and remembers how to deal with correctly. :-)
My IDE is called vim. :-P *runs and hides*
Better than Emacs loll :-P *also runs and hides*
OK, no need to ignite the flames for that flamewar.
You're missing the point. My point was that you can do this with
*arbitrarily complex sequences of operations*. Yes search and replace
with regex is a specific command that's supported by your IDE, but
what about "move one line down, one word over, increment the number
by 1 repeated 50 times to repair a table of numbers that had some
miscalculations"?
Visual Studio has a "Record Macro" feature, to record keystrokes and such, but I haven't used it, so I don't know if it does what you want -- but yeah, if it doesn't, I can see why you'd choose Vim/Emacs/whatever.
Plus, you've to keep in mind that integration with arbitrary shell commands add a whole new dimension to this that no Windows-centric IDE can ever hope to achieve. Like "filter selected lines through grep, sed, and this 1-line perl script that transforms the text in ways too complex to express with editor commands". You can even pipe the stuff through an XML parser and query engine, perform tree-based transformations, etc.. Without an adequately expressive shell on Windows, things like these are just unattainable wild fancies. For Linux lusers, they're a reality. This is because the Windows model is to have the app do everything, handle everything, be everything to the user. If the developers left out the kitchen sink, you're on your own. The Unix model, by contrast, works based on the idea that programs should interoperate, the more the better, so what this program can't do, another can, and the shell provides the unifying interface for mutual invocation. Thus it lets you tie together two programs that the developers never dreamed of putting together, and in that way achieve things they never even conceived when they wrote their code. Obligatory quote: A program should be written to model the concepts of the task it performs rather than the physical world or a process because this maximizes the potential for it to be applied to tasks that are conceptually similar and, more important, to tasks that have not yet been conceived. -- Michael B. Allen This also makes for cleaner, more robust programs, because they don't have to worry about implementing every functionality under the sun: just do what they were intended to do, and let the user hook them up with other programs to add functionality on top of it. It is possible in theory, for example, to have an external program that parses D code and does queries/transformations on them, and invoke that from vim on a particular section of code. So you can actually do IDE-like operations in vim, which in itself has no idea what D code is. Such is the power of function composition, which the Unix model strives for.
It was just for illustrative purposes. It doesn't have to be "repeat
n times"; what about "apply operation X,Y,Z until the end of the
enclosing block"?
Uhm, just highlight it and apply the operation to the highlighted block...
What I'm getting at is that logical range modifiers for operations are much more expressive than merely "highlight this, do that". Thing is, in vim the various movement keys can be applied as modifiers to a particular action. So instead of going "start highlighting, move 6 lines down, 13 columns across" you effectively say "lowercase all text from here till 2 paragraphs down, 5 words across". "Lowercase" is a basic operation, which is modified by a range specified in terms of logical units, like paragraphs and words. And because these are logical entities, not physical positions, the same command can be applied to vastly different parts of the text and still have the same logical meaning. That is, 2 paragraphs in this case may span 6 lines, but in another part of the file it may span 8 lines. By using logical positioning units, you can have the same command apply to both correctly without having to tediously construct the physical distance each time.
It sucks to have to open 15 different apps and waste time switching
between them when I could do everything without my fingers leaving
the keyboard for 1 second (and without focus-distracting cycling
through windows).
My hands don't leave the keyboard too often either... even the basics Alt-Tab/Ctrl-Tab/F8/PageUp/PageDown/etc. get the job done fairly well, and the mnemonics (e.g. Alt-O to hit the button with "O" underlined) make it 10x better.
Eeek! On most modern keyboards, PgUp/PgDn, etc., are so far out of the way that you might as well reach for the mouse. Funnily enough, one of the things I hated the most about vim was its modality. But now in retrospect, it makes SO much sense. In command mode, all your alphabetic keys can be put to good use, so your fingers never even leave typewriter position. The only bad design in vi/vim is the overuse of Esc (which is slow because of a maldesign in early unix terminal emulation, and also causes my fingers to twitch for the upper left corner of the keyboard every now and then). Besides that, everything is lightning fast because there's no need to reach all the way up to the F1-F12 row of keys, nor the badly-placed PgUp/PgDn/whatever keys. One can essentially type at maximum typewriting rate and perform editing commands at that same rate. It's so efficient that it's addictive. Once you taste that kind of power you never want to go back to the bad ole world of reaching out for obscure parts of the keyboard every 4 seconds.
Your example went over my head, 'cos I haven't used windows in any
serious way for at least 15 years. :-P
lol ok. If you get the chance sometime, might wanna give Windows 7 a try. :P
Yikes. I wouldn't touch Windows 7 with a 20-foot sterilized flagpole. XP was the last usable version of Windows in many senses of the word. There's a reason the adoption rate of Windows 7 is significantly slower than MS would like. But I freely admit I'm heavily biased, so take that with a 1kg grain of salt. :-P
 Last time I used Linux was a few days ago (Ubuntu) so I guess I'd
 naturally have more to say about it haha.
Now don't get me wrong, Ubuntu is doing a very good thing in making Linux accessible to the masses, but frankly, you haven't _really_ used Linux until you've mastered the command-line and can regularly compose long chains of pipes that does magical transformations to data without thinking twice. In my previous job, there was a part-time contractor who regularly writes 5-line long bash commands complete with subshells, multiple redirections, obscure sed/grep tricks, AND HAVE IT ALL WORK THE FIRST TIME ROUND WITHOUT NEEDING TO HIT BACKSPACE EVEN ONCE. Seriously, the guy just breathes bash command lines like a fish in water, it's uncanny. Sometimes you just stare at him compose these incredibly complex commands and your jaw just drops to the floor in amazement. Your first thought is "that can't possibly work! Isn't that a typo right there?! He spelt that option wrong!" and then the next second, your eyes are popping out of their sockets, "what the... it WORKED?!?!?!". Sufficiently advanced shell commands are indistinguishible from physics-defying magic. ;-)
Stop right there. Project settings, eh? lol...
Better than configure.in/configure/makefile.in/makefile/all that crap. :P
On that, I heartily agree. Autotools is the hellspawn of all evil, next in line to XML and Javascript. Well, ANYTHING that uses make is, frankly, the hellspawn of evil just by association. Use SCons. :-)
For me, an SConscript does my project management way better than
any IDE project settings could ever do.
[...]
Now try writing an IDE that can do all of _that_ in one go. :-P
I gotta use SCons, haven't used it before :)
Yeah, throw out your makefiles, they're from before the last ice age and reeks of poor holey design. Use SCons, or any of the much saner modern incarnations of build tools that aren't dainbramaged. (If you've ever had to deal with the monstrosities that are makefiles for very large (>2 million lines of code) projects, you'll understand why.)
XML is the spawn of evil, next in evilness only to Javascript, but
I digress. :-P Seriously though, you could just use xmlstar
(google for it) if you really have to. XML is not meant for human
consumption. Only machines can process that horribly tedious stuff
without its brain turning into a pretzel.
Haha okay well if you claim the entire STACK of tools is evil then I guess I can't help you there lol.
OK, I think I went a bit overboard with the hyperbole there. All I wanteed to say, really, is that XML is designed for machine processing, not for human processing. Trying to edit XML by hand is like trying to render a 3D animation with a magnet, a tweezer, and very very steady hands over the opened casing of your video card's GPU. Trying to read XML is like trying to give a speech while decrypting your GPG-encoded notes in your head in real-time. It's just not meant for manual manipulation. You _want_ to use specialized tools for working with it, unless you're into masochism.
You don't know what you're missing.  No, really. Trust me, I know,
because I used to hate them too. I hated them so much, that I wrote
(well, tried to write) my own editor just so that I didn't have to
use them, when pico just didn't cut it anymore for doing serious
work.  And then my supervisor at my first job made me learn vim.
Which made me hate it all the more. Until one day, after investing
lots of time (and venting lots of frustration) into learning how to
use it properly, it suddenly all *clicked*.  Try it sometime. You
might find yourself liking what you thought was impossible not to
hate, ever. :-)
Haha I definitely will. I actually never thought they were /bad/ (they're just hard to learn and unintuitive, and so I hate them) but I definitely agree, I could certainly give them another chance and perhaps like them. Will give them another try when I get the chance. :)
Well I applaud your willingness to try. :-) T -- Lottery: tax on the stupid. -- Slashdotter
May 18 2012
parent reply "Mehrdad" <wfunction hotmail.com> writes:
On Saturday, 19 May 2012 at 06:47:48 UTC, H. S. Teoh wrote:
 One day it's bound to happen, though.
Yeah I'd heard about some similar stuff too, waiting to hear about it.
 Substitute "length(" with "size(" instead of just "length" with 
 "size". Problem solved. :-)
Er, you missed the entire point of my example. :\ Those were PROPERTIES. They are used *without* parentheses. Your solution doesn't actually work on them. :P
 Worse yet, no way in hell that a command-line tool would tell 
 you your documentation is messed up. :P
Oh yeah? And what about when documentation mentions the old name of the method? In which case you *want* to rename it. :-)
My answer might suprise you then... you should _REALLY_ try using a real IDE to get a feel for what I'm talking about. Eclipse actually _automatically renames_ identifiers inside your documentation comments. All it takes is Alt+Shift+R to say you want to rename an identifier, and it corrects all references _as you type_. With 100% accuracy, I might add. Unlike the CLI-based solution, it's NOT a half-baked text-based solution. AFAIK it uses the syntax tree. Try doing that in <your-text-editor-here> :P
 I did say it's clunky. But it's also a trivial case that one 
 quickly learns and remembers how to deal with correctly. :-)
Again, see above. Your solution fails miserably when you're working with properties like In my example, since those don't have any parentheses.
 Plus, you've to keep in mind that integration with arbitrary 
 shell commands add a whole new dimension to this that no 
 Windows-centric IDE can ever hope to achieve.
+1 yes, it's powerful indeed. But they're all text-based. Editing source code with text-based tools is error-prone. Editing them with an IDE that uses the syntax tree is not. Simple as that.
 It is possible in theory
key word here :P ^
 Thing is, in vim the various movement keys can be applied as 
 modifiers to a particular action. And because these are logical 
 entities, not physical positions, the same command can be 
 applied to vastly different parts of the text and still have 
 the same logical meaning. That is, 2 paragraphs in this case 
 may span 6 lines, but in another part of the file it may span 8 
 lines.
Yes, that's very powerful. But again, it's for *TEXT*, not CODE. Unless your editor can go "two scopes down and six statements to the right", what you're saying doesn't really work for code (or maybe I'm not understanding it right?).
 Eeek! On most modern keyboards, PgUp/PgDn, etc., are so far out 
 of the way that you might as well reach for the mouse.
Lol, 100% correct -- except in my situation. :P I code on my laptop, and it's Fn+Up and Fn-Down. Home/End are Fn-Left and Fn-Right. Takes a little getting used to at the beginning, but it's VERY handy. :) Especially compared to ESC, as you mentioned.
 Yikes. I wouldn't touch Windows 7 with a 20-foot sterilized 
 flagpole. XP was the last usable version of Windows in many 
 senses of the word.
If you haven't used it then you can't really say that now, can you? (If you're thinking of Vista when you think of 7, FYI it's on the opposite end of the spectrum from Windows 7. And if you don't like the looks, you can always switch to an XP-like theme, like me.)
 There's a reason the adoption rate of Windows 7 is 
 significantly slower than MS would like.
I thought it was doing well? But yeah I just swallowed your chunk of salt, thanks. :P
 Now don't get me wrong, Ubuntu is doing a very good thing in 
 making Linux accessible to the masses, but frankly, you haven't 
  _really_ used Linux until you've mastered the command-line and 
 can regularly compose long chains of pipes that does magical 
 transformations to data without thinking twice. In my previous 
 job, there was a part-time contractor who regularly writes 
 5-line long bash commands complete with subshells, multiple 
 redirections, obscure sed/grep tricks, AND HAVE IT ALL WORK THE 
 FIRST TIME ROUND WITHOUT NEEDING TO HIT BACKSPACE EVEN ONCE. 
 Seriously, the guy just breathes bash command lines like a fish 
 in water,
My God, how I wish I could do that! :O As much as I'm not a Linux fan, I still want that ability -- it can be very *very* useful in quite a few situations!!
 it's uncanny. Sometimes you just stare at him compose these 
 incredibly complex commands and your jaw just drops to the 
 floor in  amazement. Your first thought is "that can't possibly 
 work! Isn't that a typo right there?! He spelt that option 
 wrong!" and then the next second, your eyes are popping out of 
 their sockets, "what the... it WORKED?!?!?!".
I've seen 1 person who did stuff *close* to what you're describing... and yes, my jaw dropped indeed, so I know what you mean perfectly. it's... out of this world... x___x
 Sufficiently advanced shell commands are indistinguishible from 
 physics-defying magic. ;-)
+1
 (If you've ever had to deal with the monstrosities that are 
 makefiles for very large (>2 million lines of code) projects, 
 you'll understand why.)
Spending days on end trying to compile GCC and GDC (and ultimately failing) was more than enough time wasted for the rest of my life, so I know perfectly what you mean. xD
 You _want_ to use specialized tools for working with it, unless 
 you're into masochism.
Haha right, that's why I don't really edit XML text directly. xD
 Well I applaud your willingness to try. :-)
Thanks, I downloaded GVim a few hours ago. Now to find some time to learn it haha... it turns me off pretty badly every time I open it (hell, it doesn't even save my font settings...)
May 19 2012
parent reply "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Sat, May 19, 2012 at 09:45:20AM +0200, Mehrdad wrote:
 On Saturday, 19 May 2012 at 06:47:48 UTC, H. S. Teoh wrote:
[...]
Substitute "length(" with "size(" instead of just "length" with
"size". Problem solved. :-)
Er, you missed the entire point of my example. :\ Those were PROPERTIES. They are used *without* parentheses. Your solution doesn't actually work on them. :P
OK, I concede. :)
Worse yet, no way in hell that a command-line tool would tell you
your documentation is messed up. :P
Oh yeah? And what about when documentation mentions the old name of the method? In which case you *want* to rename it. :-)
My answer might suprise you then... you should _REALLY_ try using a real IDE to get a feel for what I'm talking about. Eclipse actually _automatically renames_ identifiers inside your documentation comments. All it takes is Alt+Shift+R to say you want to rename an identifier, and it corrects all references _as you type_. With 100% accuracy, I might add. Unlike the CLI-based solution, it's NOT a half-baked text-based solution. AFAIK it uses the syntax tree.
Now that _is_ pretty cool. Actually I've been thinking about this kind of problems. It's not just code, actually, the problem is much more general than that. It applies to _any_ structured text. See, the thing is, one of the reasons I like vim in spite of its warts (yes it has warts, including what we're discussing here about syntax trees transformations) is that it gives me a _unified_ environment for working with all kinds of files: text files, XML files, configuration files with their own syntax, code in all kinds of languages, other files with formatted syntax, Python (hehe), and even my 4-dimensional esolang. The unification is very convenient: no need to switch between 15 different tools to work with different file formats. Better yet, you can do things like quote code in emails, write cross-language code, etc., without flinching. But this unification is also its downfall: plain text, as the lowest common denominator, also suffers from not being able to deal with syntax trees in a meaningful way. So what is needed is a way of plugging in arbitrary syntax tree parsers, such that you can have a generic editing environment which can handle any structured text, not just code, but _anything_ that can be parsed. You then have a basic core of text-editing operations, plus semantic operations that work with the syntax trees directly. Now vim actually does have plugin capability, though I'm not sure if it's general enough to do what I just described.
 Try doing that in <your-text-editor-here>
 
 :P
Don't be shocked if you find a vim plugin that does just that. ;-)
I did say it's clunky. But it's also a trivial case that one quickly
learns and remembers how to deal with correctly. :-)
Again, see above. Your solution fails miserably when you're working with properties like In my example, since those don't have any parentheses.
True.
Plus, you've to keep in mind that integration with arbitrary shell
commands add a whole new dimension to this that no Windows-centric
IDE can ever hope to achieve.
+1 yes, it's powerful indeed. But they're all text-based. Editing source code with text-based tools is error-prone. Editing them with an IDE that uses the syntax tree is not. Simple as that.
It would be really cool if there were syntax tree manipulators that could do stuff like that. Actually, thinking a bit more about what I wrote above, what if there were external parser programs that can do these kinds of transformations, then you can just invoke them to do their magic when you need syntax-tree based manipulations. A text editor really should just do one thing: edit text. With full command-line integration, you can even bind certain operations to external utilities that specialize in whatever language/format they're designed to deal with. Unix philosophy: every program does one thing, and does it really well; connect them together, and you can do stuff no individual program can hope to do, even stuff none of the authors of said programs even imagined possible.
It is possible in theory
key word here :P ^
Ah, but isn't that what we programmers specialize in? Turning theory into reality. ;-)
Thing is, in vim the various movement keys can be applied as
modifiers to a particular action. And because these are logical
entities, not physical positions, the same command can be applied to
vastly different parts of the text and still have the same logical
meaning. That is, 2 paragraphs in this case may span 6 lines, but in
another part of the file it may span 8 lines.
Yes, that's very powerful. But again, it's for *TEXT*, not CODE. Unless your editor can go "two scopes down and six statements to the right", what you're saying doesn't really work for code (or maybe I'm not understanding it right?).
Actually, vim does have some rudimentary support for moving across scopes. I don't know about statements, though.
Eeek! On most modern keyboards, PgUp/PgDn, etc., are so far out of
the way that you might as well reach for the mouse.
Lol, 100% correct -- except in my situation. :P I code on my laptop, and it's Fn+Up and Fn-Down. Home/End are Fn-Left and Fn-Right. Takes a little getting used to at the beginning, but it's VERY handy. :)
Ahh laptop keyboard. Honestly, I like the layout better (the standard PC keyboard is way too wide). However, the _size_ of a laptop keyboard is just too uncomfortable for me -- I have rather large hands, you see. After a while, my fingers just feel too cramped. Laptop keyboards also have the advantage that they can have those nipple things to replace the mouse. This actually makes mouse usage marginally palatable, even for hardcore CLI freaks like me. [...]
Yikes. I wouldn't touch Windows 7 with a 20-foot sterilized
flagpole. XP was the last usable version of Windows in many senses
of the word.
If you haven't used it then you can't really say that now, can you? (If you're thinking of Vista when you think of 7, FYI it's on the opposite end of the spectrum from Windows 7. And if you don't like the looks, you can always switch to an XP-like theme, like me.)
OK I admit I was being unfair. See, my problem is, the second I have to deal with rodent navigation and clicking through menus, I just get really really frustrated that I can't just tell the stupid machine to do what I already know I want to do. So any GUI interface just grates on my nerves -- what d'you mean I can't pipe the output of this program into that one? I just don't _think_ like that. It's like being reduced to pointing and grunting instead of using words when you're trying to talk about physics. [...]
Now don't get me wrong, Ubuntu is doing a very good thing in
making Linux accessible to the masses, but frankly, you haven't
_really_ used Linux until you've mastered the command-line and can
regularly compose long chains of pipes that does magical
transformations to data without thinking twice. In my previous
job, there was a part-time contractor who regularly writes 5-line
long bash commands complete with subshells, multiple redirections,
obscure sed/grep tricks, AND HAVE IT ALL WORK THE FIRST TIME ROUND
WITHOUT NEEDING TO HIT BACKSPACE EVEN ONCE. Seriously, the guy
just breathes bash command lines like a fish in water,
My God, how I wish I could do that! :O As much as I'm not a Linux fan, I still want that ability -- it can be very *very* useful in quite a few situations!!
I can do that to a limited extent. Still nowhere close to that guy, though. What I can do is like baby-talk compared to his refined bash-speak. :-)
it's uncanny. Sometimes you just stare at him compose these
incredibly complex commands and your jaw just drops to the floor
in  amazement. Your first thought is "that can't possibly work!
Isn't that a typo right there?! He spelt that option wrong!" and
then the next second, your eyes are popping out of their sockets,
"what the... it WORKED?!?!?!".
I've seen 1 person who did stuff *close* to what you're describing... and yes, my jaw dropped indeed, so I know what you mean perfectly. it's... out of this world... x___x
Same thing happens when a D newbie looks at a pro writing D code with seemingly magical templates and compile-time introspection that does wonders in mysterious ways. :-) [...]
(If you've ever had to deal with the monstrosities that are
makefiles for very large (>2 million lines of code) projects,
you'll understand why.)
Spending days on end trying to compile GCC and GDC (and ultimately failing) was more than enough time wasted for the rest of my life, so I know perfectly what you mean. xD
Yikes!! GCC is one of the prime examples of makefiles gone horribly, horribly _wrong_. Well, that, and the entire autotools suite, which is exemplary for macros gone wrong. You do realize that building GCC involves two stages, right? You first build the thing once with your current compiler (which in itself is no mean feat), to "bootstrap" it, and _then_ you use the resulting compiler to compile itself, to produce the final compiler. This is arcane black magic, in the realm of Ken Thompson's "Trusting Trust" (http://cm.bell-labs.com/who/ken/trust.html). Novices and mortals beware.
You _want_ to use specialized tools for working with it, unless
you're into masochism.
Haha right, that's why I don't really edit XML text directly. xD
Y'know, with my idea of plugins that do specialized things, you might just be able to edit XML in a pain-free way in vim. Hmmm... actually: http://www.vim.org/scripts/script.php?script_id=301 Ah, the wonders of opensource. :-)
Well I applaud your willingness to try. :-)
Thanks, I downloaded GVim a few hours ago. Now to find some time to learn it haha... it turns me off pretty badly every time I open it (hell, it doesn't even save my font settings...)
[...] Yikes! I highly recommend using plain vanilla vim, no GUI, no fonts, no nothing, just pure, unadulterated text. Experience it like it was meant to be used. :-) OK, maybe I'm just being too extreme here. I'll shut up now. T -- Perhaps the most widespread illusion is that if we were in power we would behave very differently from those who now hold it---when, in truth, in order to get power we would have to become very much like them. -- Unknown
May 19 2012
next sibling parent reply "Mehrdad" <wfunction hotmail.com> writes:
On Saturday, 19 May 2012 at 20:00:03 UTC, H. S. Teoh wrote:
 Now that _is_ pretty cool.
:D yes!
 See, the thing is, one of the reasons I like vim in spite of 
 its warts (yes it has warts, including what we're discussing 
 here about syntax trees transformations) is that it gives me a 
 _unified_ environment for working with all kinds of files
Indeed, that's one of the major reasons people use text editors over IDEs for a lot of tasks.
 Don't be shocked if you find a vim plugin that does just that. 
 ;-)
I dunno, I might be xD
 It would be really cool if there were syntax tree manipulators
Omg yeah. And I think D is probably the closest to getting something like that. I remember asking about whether something like this this in StackOverflow, but (perhaps because I didn't phrase myself properly) people didn't really understand what I was saying and I kinda got blank responses lol.
 Ah, but isn't that what we programmers specialize in? Turning 
 theory into reality. ;-)
Touche
 Actually, vim does have some rudimentary support for moving 
 across scopes. I don't know about statements, though.
Yeah, editors often have brace-matching and stuff ("go to matching/enclosing brace") but yeah, not statements.
 Honestly, I like the layout better (the standard PC keyboard is 
 way too wide). However, the _size_ of a laptop keyboard is just 
 too uncomfortable for me
Yup, I've been debating if I want a real-sized keyboard or not... might order one these days. :)
 OK I admit I was being unfair. See, my problem is, the second I 
 have to deal with rodent navigation and clicking through menus, 
 I just get really really frustrated that I can't just tell the 
 stupid machine to do what I already know I want to do.
Totally understand what you mean -- I could say the same thing for *nix tools, just the other way around. (Why can't I *browse* my choices? why do I have to look at /documentation/, for God's sake, to figure out how to just locate a file on my computer? etc.)
 Yikes!!
Indeed, that says it all. xD
 You do realize that building GCC involves two stages, right?
Someone told me like a year later. XD
 	http://www.vim.org/scripts/script.php?script_id=301
 Ah, the wonders of opensource. :-)
:) I have a love-hate relationship with OS. It's among the greatest things in CS but it also has its own problems. I was going to post a link to a blog post I read about it, but while I agree with it, it's a little harsher than my view, so maybe not. xD
 Yikes! I highly recommend using plain vanilla vim, no GUI
Oh geez, that'll take a while lol. At least with GVim, I can discover the command names through the menus haha.
May 19 2012
next sibling parent Sean Kelly <sean invisibleduck.org> writes:
	charset=us-ascii

On May 19, 2012, at 1:35 PM, "Mehrdad" <wfunction hotmail.com> wrote:

 On Saturday, 19 May 2012 at 20:00:03 UTC, H. S. Teoh wrote:
=20
 Yikes! I highly recommend using plain vanilla vim, no GUI
=20 Oh geez, that'll take a while lol. At least with GVim, I can discover the c=
ommand names through the menus haha. The only way to really learn vim is to suffer through it until it clicks. Th= e experience is so fundamentally different than other editors, that menus wo= uld just prevent that from happening. That said, some editors, like Sublime T= ext 2 (my current favorite) have a vi mode that functions pretty closely to h= ow vi does. It's another way to ease your way into the vi mindset, as it wer= e. Personally, I know enough vi to get around but not enough to prefer it. I= t's simy a matter of necessity though, as vi is the only editor I've found i= nstalled on every system I need to edit on. Too bad it couldn't at least be v= im though.=20=
May 19 2012
prev sibling parent reply "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Sat, May 19, 2012 at 04:53:32PM -0700, Sean Kelly wrote:
 On May 19, 2012, at 1:35 PM, "Mehrdad" <wfunction hotmail.com> wrote:
 
 On Saturday, 19 May 2012 at 20:00:03 UTC, H. S. Teoh wrote:
 
 Yikes! I highly recommend using plain vanilla vim, no GUI
Oh geez, that'll take a while lol. At least with GVim, I can discover the command names through the menus haha.
The only way to really learn vim is to suffer through it until it clicks. The experience is so fundamentally different than other editors, that menus would just prevent that from happening.
Exactly. Until you've grappled with GUI-less vim, you haven't _really_ used vim. I did say that it was a very frustrating experience for me. But when it clicked, it _really_ clicked. Now I couldn't bear to use pico or joe or any of that stuff. They've become so foreign to me. It's one of those things that have a totally steep learning curve, but totally worth it once you get it. Just like console Linux/bash. (Even I myself find it hard to believe, but there was a time when I used to _hate_ Linux. Yeah.) Or ratpoison (aka how to use a GUI without a mouse). :-P
 That said, some editors, like Sublime Text 2 (my current favorite)
 have a vi mode that functions pretty closely to how vi does. It's
 another way to ease your way into the vi mindset, as it were.
 Personally, I know enough vi to get around but not enough to prefer
 it. It's simy a matter of necessity though, as vi is the only editor
 I've found installed on every system I need to edit on. Too bad it
 couldn't at least be vim though. 
Ugh. Plain vi (non-vim) is a bear to use. Many non-vim vi's have an undo buffer with a depth of 1. And it just goes downhill from there. :-P But at least, once you've eased into the vim mindset, you can navigate around inferior vi's without stumbling into electric fences and stubbing your toes. T -- You are only young once, but you can stay immature indefinitely. -- azephrahel
May 19 2012
parent reply Paulo Pinto <pjmlp progtools.org> writes:
Am 20.05.2012 07:43, schrieb H. S. Teoh:
 [...]
 That said, some editors, like Sublime Text 2 (my current favorite)
 have a vi mode that functions pretty closely to how vi does. It's
 another way to ease your way into the vi mindset, as it were.
 Personally, I know enough vi to get around but not enough to prefer
 it. It's simy a matter of necessity though, as vi is the only editor
 I've found installed on every system I need to edit on. Too bad it
 couldn't at least be vim though.
Ugh. Plain vi (non-vim) is a bear to use. Many non-vim vi's have an undo buffer with a depth of 1. And it just goes downhill from there. :-P But at least, once you've eased into the vim mindset, you can navigate around inferior vi's without stumbling into electric fences and stubbing your toes. T
One thing I hate is visiting customers which have UNIX installations configured with their default installs. Depending on the operating system version, sometimes I feel like I am back in 197x, with the original versions of vi, sh, sed, and so on. The people that only have GNU/Linux or BSD experience, don't have any idea how spoiled they are when compared with the commercial UNIX vendors offerings. -- Paulo
May 19 2012
parent reply "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Sun, May 20, 2012 at 07:59:49AM +0200, Paulo Pinto wrote:
[...]
 One thing I hate is visiting customers which have UNIX installations
 configured with their default installs.
 
 Depending on the operating system version, sometimes I feel like I am
 back in 197x, with the original versions of vi, sh, sed, and so on.
 
 The people that only have GNU/Linux or BSD experience, don't have any
 idea how spoiled they are when compared with the commercial UNIX
 vendors offerings.
[...] Commercial Unixen have been on the decline for the last 2 decades (probably more). I remember having to work with Solaris in my first job. I had the dubious pleasure of working with its packaging system once, and ... Let's put it this way: I first started using Linux back in the day when you had to download packages manually and sort out all package dependencies by hand. Get just _one_ package with the wrong version, and you have a broken system. Lots of roundtrips on sneakernet. Imagine the horror of that. Now, that was actually a _pleasure_ in comparison with the Solaris package manager. That's how horrible it was. It doesn't keep track of files (what is a package manager _for_ again?!): it liberally overwrites files from different packages, leaves random files lying around after removing packages which causes all sorts of conflicts with future package installations, has no usable version tracking to speak of, and in general is such a horrible train wreck you might as well be installing the entire system from tarballs instead (you'd probably have an easier time). It's all the horror of Windows without Install Shield, minus the eye-candy, and without the option to reinstall the entire OS when things screw up horribly (because usually it's running on a critical production server that can't afford to go down). And today Linux is actually making its way onto non-technical user's desktops (e.g. Ubuntu), with automated installs, one-command upgrade between _major_ OS releases, autodetected system configuration (e.g., X11)? It's the difference between north pole and south pole. Commercial Unixen for all practical purposes are as dead as can be, waiting for the final nails to be driven into their collective coffins. T -- PNP = Plug 'N' Pray
May 20 2012
parent "Paulo Pinto" <pjmlp progtools.org> writes:
On Sunday, 20 May 2012 at 14:57:21 UTC, H. S. Teoh wrote:
 On Sun, May 20, 2012 at 07:59:49AM +0200, Paulo Pinto wrote:
 [...]
 One thing I hate is visiting customers which have UNIX 
 installations
 configured with their default installs.
 
 Depending on the operating system version, sometimes I feel 
 like I am
 back in 197x, with the original versions of vi, sh, sed, and 
 so on.
 
 The people that only have GNU/Linux or BSD experience, don't 
 have any
 idea how spoiled they are when compared with the commercial 
 UNIX
 vendors offerings.
[...] Commercial Unixen have been on the decline for the last 2 decades (probably more). I remember having to work with Solaris in my first job. I had the dubious pleasure of working with its packaging system once, and ... Let's put it this way: I first started using Linux back in the day when you had to download packages manually and sort out all package dependencies by hand. Get just _one_ package with the wrong version, and you have a broken system. Lots of roundtrips on sneakernet. Imagine the horror of that. Now, that was actually a _pleasure_ in comparison with the Solaris package manager. That's how horrible it was. It doesn't keep track of files (what is a package manager _for_ again?!): it liberally overwrites files from different packages, leaves random files lying around after removing packages which causes all sorts of conflicts with future package installations, has no usable version tracking to speak of, and in general is such a horrible train wreck you might as well be installing the entire system from tarballs instead (you'd probably have an easier time). It's all the horror of Windows without Install Shield, minus the eye-candy, and without the option to reinstall the entire OS when things screw up horribly (because usually it's running on a critical production server that can't afford to go down). And today Linux is actually making its way onto non-technical user's desktops (e.g. Ubuntu), with automated installs, one-command upgrade between _major_ OS releases, autodetected system configuration (e.g., X11)? It's the difference between north pole and south pole. Commercial Unixen for all practical purposes are as dead as can be, waiting for the final nails to be driven into their collective coffins. T
Well on my part of the world commercial UNIX is pretty much alive. Enterprise companies like a lot the type of support contracts they can get from UNIX vendors. Plus there are many features where Linux/BSD still aren't a match, like the Solaris ZFS, or the security zones for application sandboxing. But thanks for your reply, it really shows how the life in real UNIX land looks like, for those that only know GNU/Linux and BSD. -- Paulo
May 21 2012
prev sibling parent reply =?UTF-8?B?IkrDqXLDtG1lIE0uIEJlcmdlciI=?= <jeberger free.fr> writes:
H. S. Teoh wrote:
 But this unification is also its downfall: plain text, as the lowest
 common denominator, also suffers from not being able to deal with synta=
x
 trees in a meaningful way.
=20
 So what is needed is a way of plugging in arbitrary syntax tree parsers=
,
 such that you can have a generic editing environment which can handle
 any structured text, not just code, but _anything_ that can be parsed.
 You then have a basic core of text-editing operations, plus semantic
 operations that work with the syntax trees directly.
=20
You mean like Emacs' Semantic mode? https://www.gnu.org/software/emacs/manual/html_node/emacs/Semantic.html Jerome --=20 mailto:jeberger free.fr http://jeberger.free.fr Jabber: jeberger jabber.fr
May 19 2012
parent "Mehrdad" <wfunction hotmail.com> writes:
On Saturday, 19 May 2012 at 20:58:40 UTC, Jérôme M. Berger 
wrote:
 	You mean like Emacs' Semantic mode?
 https://www.gnu.org/software/emacs/manual/html_node/emacs/Semantic.html
O_O
May 19 2012
prev sibling parent reply Sean Kelly <sean invisibleduck.org> writes:
On May 18, 2012, at 7:10 PM, "Mehrdad" <wfunction hotmail.com> wrote:
=20
 2. Okay, so that's clever. :P Now tell me what you do when you have dozens=
of lines in your source file like
=20
     property auto length() { return _range.length; }
=20
 and you want to rename the field 'length'? How do you prevent the second o=
ne from getting renamed? sed using a regex that accounts for more of the line than just "length", lik= e " length(". It only gets tricky if you are renaming a method call with a n= on-unique name, which is when you need to use compiler output to flag the of= fending lines since pure text analysis won't cut it.=20
 Or say you have
=20
     property auto back() { ... }
     property moveBack() { assert(0, "Cannot move an element from the back!=
"); }
    auto popBack() { }    // Remove an element from the back
=20
 and you change the name of the property 'back' to 'last':
=20
     property auto back() { ... }
     property moveBack() { assert(0, "Cannot move an element from the last!=
"); }
    auto popBack() { }    // Remove an element from the last
=20
 Notice something funny?
Three operations, one for each method actually being renamed. Ultimately, it= 's hard to replace a real refactoring tool since it has a compiler built-in t= hough. That said, I don't personally do this kind of thing... pretty much ev= er. So using a special tool when needed seems like an option.=20
May 19 2012
parent "Paulo Pinto" <pjmlp progtools.org> writes:
On Saturday, 19 May 2012 at 13:49:28 UTC, Sean Kelly wrote:
 On May 18, 2012, at 7:10 PM, "Mehrdad" <wfunction hotmail.com> 
 wrote:
 
 2. Okay, so that's clever. :P Now tell me what you do when you 
 have dozens of lines in your source file like
 
     property auto length() { return _range.length; }
 
 and you want to rename the field 'length'? How do you prevent 
 the second one from getting renamed?
sed using a regex that accounts for more of the line than just "length", like " length(". It only gets tricky if you are renaming a method call with a non-unique name, which is when you need to use compiler output to flag the offending lines since pure text analysis won't cut it.
Somehow I fail to see how this is more productive than doing a "rename method" option.
May 19 2012
prev sibling parent reply Sean Kelly <sean invisibleduck.org> writes:
On May 18, 2012, at 5:39 PM, "Mehrdad" <wfunction hotmail.com> wrote:
=20
 Yeah, imagine trying to name a method named "getValue()" to something else=
(probably because you realized that's not a great name :P).
=20
 A HUGE time waster without refactoring tools, and last time I checked, no t=
ext-based tool did it. Possibly because this can be accomplished from the command line with find/gr= ep/sed and the like.=20=
May 19 2012
parent reply Paulo Pinto <pjmlp progtools.org> writes:
Am 19.05.2012 15:35, schrieb Sean Kelly:
 On May 18, 2012, at 5:39 PM, "Mehrdad"<wfunction hotmail.com>  wrote:
 Yeah, imagine trying to name a method named "getValue()" to something else
(probably because you realized that's not a great name :P).

 A HUGE time waster without refactoring tools, and last time I checked, no
text-based tool did it.
Possibly because this can be accomplished from the command line with find/grep/sed and the like.
While wiping everything else that is also called getValue() along the way, even if they belong to instances of other classes. I like UNIX and the command line is invaluable for certain tasks regardless of the operating system, but sometimes I wonder if people realized that it is no longer 1970 and better ways to develop software do exist. -- Paulo
May 19 2012
parent reply "David Nadlinger" <see klickverbot.at> writes:
On Saturday, 19 May 2012 at 19:28:44 UTC, Paulo Pinto wrote:
 I like UNIX and the command line is invaluable for certain 
 tasks regardless of the operating system, but sometimes I 
 wonder if people realized that it is no longer 1970 and better 
 ways to develop software do exist.
…especially because it would be perfectly possible to provide a command-line interface to »intelligent« (i.e. frontend-backed) refactoring tools as well. David
May 19 2012
parent "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Sat, May 19, 2012 at 09:43:13PM +0200, David Nadlinger wrote:
 On Saturday, 19 May 2012 at 19:28:44 UTC, Paulo Pinto wrote:
I like UNIX and the command line is invaluable for certain tasks
regardless of the operating system, but sometimes I wonder if
people realized that it is no longer 1970 and better ways to
develop software do exist.
…especially because it would be perfectly possible to provide a command-line interface to »intelligent« (i.e. frontend-backed) refactoring tools as well.
[...] +1. I think the ideal development environment would be one where there are reusable parsers and syntax-tree rewriters (either standalone programs or libraries with generic API), that can be used to do semantic-level text manipulations, which can then be used with basic text-editing functions. I envision something like this (using vim as an example, substitute your favorite editor at will): have a bunch of language-specific plugins, like xml, c, c++, d, etc., for basic syntax-tree level navigation through source code, bound to a bunch of designated syntax-tree navigation keys in the editor, plus a bunch of language-specific operations (like rename identifiers, move nested function in/out of nesting, etc.) bound to some kind of command interface, which can be aliased to unused command keys. These plugins can be applied to arbitrary blocks of text -- usually an entire buffer, but possibly to sections within a buffer, such as D code embedded in an email, or XML embedded in a heredoc, etc.. The plugins autodetect the environment they're in, much like vim already does nowadays to a limited extent, but you can also bind specific plugins to sections of text at will. Now you have an environment that lets you work on all kinds of files in all kinds of formats, with basic text editing capability common to all of them, plus semantic actions for language-specific operations. Best of all, these plugins have a common, generic API, that can be reused by _anything_. Imagine if you can, for example, grep for stuff in a large source tree and have grep automatically detect the language of a particular file so that it can use a plugin for locating stuff at specified places in a syntax tree. You'd then be able to do really handy stuff like "find this regex in the body of for loops that are nested inside a top-level function", or "enumerate all occurrences of if-statements nested at least 3 levels deep". T -- Error: Keyboard not attached. Press F1 to continue. -- Yoon Ha Lee, CONLANG
May 19 2012
prev sibling parent Stewart Gordon <smjg_1998 yahoo.com> writes:
On 19/05/2012 00:51, H. S. Teoh wrote:
 On Sat, May 19, 2012 at 01:21:56AM +0200, Mehrdad wrote:
 On Friday, 18 May 2012 at 23:02:18 UTC, H. S. Teoh wrote:

 I find IDEs more painful to use than scratching your nails on a
 chalkboard. The inability of running an IDE over a remote SSH
 session without everything slowing down to a snail crawl makes it
 completely unusable for me.
Have you tried running Eclipse/Visual Studio over Remote Desktop on Windows?
I don't use Windows except when I have to fix my wife's windows laptop. :-P
 Was it actually that slow?
Anything that has a GUI is unacceptably slow over a remote connection, last time I checked. I'm not talking about connecting over a local network, which doesn't really count, but a connection over the internet.
If you want to see _real_ slowness, try opening in MS Access (running locally) a .mdb that is on a fileserver accessed via a VPN connection. That's what they briefly made me do in one of my recent jobs. <snip>
 It works on Linux as well, and it's amazing. (Not quite as powerful
 as Emacs/Vim, but it's hella more intuitive/easier to use, so worth
 it IMO.)
"Intuitive" text editors are ultimately also limited by their intuitiveness, because what most people think of as "intuitive" is "what I type appears on the screen" and "I don't have to memorize obscure key sequences to get stuff done".
<snip> No, because such an editor could still provide obscure key sequences for those advanced features that are beyond what can reasonably be done with an intuitive GUI. Whatever those advanced features are. Stewart.
May 19 2012
prev sibling parent Dmitry Olshansky <dmitry.olsh gmail.com> writes:
On 19.05.2012 3:03, H. S. Teoh wrote:
 On Fri, May 18, 2012 at 11:08:26PM +0200, Mehrdad wrote:
 On Friday, 18 May 2012 at 19:40:35 UTC, H. S. Teoh wrote:
 This is one of those things that makes Windows (l)users wonder how we
 Unix people can stand using the shell all day -- their idea of shell
 is the DOS prompt (a veritable train wreck of train wrecks).  If only
 they knew what a *real* shell can do. ;-)
Don't generalize. :P
Well, that was partially tongue-in-cheek. ;-)
 I'm a Windows user, but yes, I've used Linux.... and yes, the command
 prompt is indeed a train wreck. Bash is indeed a lot better.

 And no, I haven't used PowerShell; I hate programs that take too long
 to start up.
Whoa. PowerShell takes a long time to start up? Sounds like it's already a train wreck even before you start using it.
Far is the command line for windows. And a decent editor, and ftp client that doesn't suck and.. -- Dmitry Olshansky
May 19 2012