May 18, 2012
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
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
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
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
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
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 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...

The Windows code should do the same thing as far as runtime initialization is concerned.
May 18, 2012
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
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
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
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).

With an IDE (at least with C# in Visual Studio): just erase the 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