June 11, 2013 Re: reddit discussion on replacing Python in 0install | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On Tuesday, 11 June 2013 at 00:36:50 UTC, Walter Bright wrote: > Ah, I see. In that case, writeln should have thrown an exception. Should submit a bug report. http://d.puremagic.com/issues/show_bug.cgi?id=10328 |
June 11, 2013 Re: reddit discussion on replacing Python in 0install | ||||
---|---|---|---|---|
| ||||
Posted in reply to Anthony Goins | On 6/10/13 6:06 PM, Anthony Goins wrote:
> On Monday, 10 June 2013 at 20:51:16 UTC, Jesse Phillips wrote:
>> On Monday, 10 June 2013 at 18:25:05 UTC, Graham Fawcett wrote:
>>> Hi folks,
>>>
>>> There's an interesting discussion going on at Reddit about choosing a
>>> replacement language for 0install:
>>>
>>> http://www.reddit.com/r/programming/comments/1g1fhf/case_study_for_replacing_python_in_0install/
>>>
>>>
>>> I've tried to do a bit of D advocacy there, but there's more to be
>>> done. :) If you have a few moments to dispel some D myths, and
>>> contribute constructively to the discussion, please take a look!
>>>
>>> Best,
>>> Graham
>>
>> I don't know how to make this test on Windows (current OS). But he
>> uses this to test that failure to print hello correctly indicates
>> failure.
>>
>> ./hello 1< /dev/null; echo Exit status: $?
>>
>> And Rust is the only one to pass in his list (ATS, C#, Go, Haskell,
>> OCaml, Python)
>
> If you want to know what happens on my linux box
>
> 1 module hellotest;
> 2
> 3 import std.stdio;
> 4
> 5 void main()
> 6 {
> 7 writeln("hello world.");
> 8 }
>
> anthony@LinuxGen12:~/projects/temp$ ./hellotest
> hello world.
> anthony@LinuxGen12:~/projects/temp$ ./hellotest 1</dev/null; echo status
> : $?
> status : 0
> anthony@LinuxGen12:~/projects/temp$
The test program is flawed; writeln() writes to stdout, and the redirection is to stdin.
writeln throws upon error.
Andrei
|
June 11, 2013 Re: reddit discussion on replacing Python in 0install | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Tuesday, 11 June 2013 at 04:02:59 UTC, Andrei Alexandrescu wrote:
> The test program is flawed; writeln() writes to stdout, and the redirection is to stdin.
Wouldn't stdin be fd 0?
David
|
June 11, 2013 Re: reddit discussion on replacing Python in 0install | ||||
---|---|---|---|---|
| ||||
Posted in reply to David Nadlinger | On Tuesday, 11 June 2013 at 04:04:03 UTC, David Nadlinger wrote:
> On Tuesday, 11 June 2013 at 04:02:59 UTC, Andrei Alexandrescu wrote:
>> The test program is flawed; writeln() writes to stdout, and the redirection is to stdin.
>
> Wouldn't stdin be fd 0?
>
> David
What David said. Here's the same thing done to a cat (poor kitty):
$ cat 1</dev/null
test
cat: write error: Bad file descriptor
|
June 11, 2013 Re: reddit discussion on replacing Python in 0install | ||||
---|---|---|---|---|
| ||||
Posted in reply to David Nadlinger | On 6/11/13 12:04 AM, David Nadlinger wrote:
> On Tuesday, 11 June 2013 at 04:02:59 UTC, Andrei Alexandrescu wrote:
>> The test program is flawed; writeln() writes to stdout, and the
>> redirection is to stdin.
>
> Wouldn't stdin be fd 0?
>
> David
Oh indeed my bad. But the test is still flawed. Consider:
import std.stdio;
int main()
{
return printf("test\n") < 0;
}
This should return 1 if printf fails. It succeeds for 1</dev/null.
Andrei
|
June 11, 2013 Re: reddit discussion on replacing Python in 0install | ||||
---|---|---|---|---|
| ||||
Posted in reply to Infiltrator | On 6/11/13 12:16 AM, Infiltrator wrote:
> On Tuesday, 11 June 2013 at 04:04:03 UTC, David Nadlinger wrote:
>> On Tuesday, 11 June 2013 at 04:02:59 UTC, Andrei Alexandrescu wrote:
>>> The test program is flawed; writeln() writes to stdout, and the
>>> redirection is to stdin.
>>
>> Wouldn't stdin be fd 0?
>>
>> David
>
> What David said. Here's the same thing done to a cat (poor kitty):
>
> $ cat 1</dev/null
> test
> cat: write error: Bad file descriptor
No, this is also wrong. cat reads and writes, "hello world" only writes. Consider:
echo meh 1</dev/null
Always succeeds.
Andrei
|
June 11, 2013 Re: reddit discussion on replacing Python in 0install | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Tue, 11 Jun 2013 01:39:47 -0400 Andrei Alexandrescu <SeeWebsiteForEmail@erdani.org> wrote: > On 6/11/13 12:16 AM, Infiltrator wrote: > > On Tuesday, 11 June 2013 at 04:04:03 UTC, David Nadlinger wrote: > >> On Tuesday, 11 June 2013 at 04:02:59 UTC, Andrei Alexandrescu wrote: > >>> The test program is flawed; writeln() writes to stdout, and the > >>> redirection is to stdin. > >> > >> Wouldn't stdin be fd 0? > >> > >> David > > > > What David said. Here's the same thing done to a cat (poor kitty): > > > > $ cat 1</dev/null > > test > > cat: write error: Bad file descriptor > > No, this is also wrong. cat reads and writes, "hello world" only writes. Consider: > > echo meh 1</dev/null > > Always succeeds. > I just tried both on Debian 6: nick@debian6:~$ cat 1< /dev/null cfws cat: write error: Bad file descriptor nick@debian6:~$ echo meh 1< /dev/null bash: echo: write error: Bad file descriptor Maybe OSX behaves differently? |
June 11, 2013 Re: reddit discussion on replacing Python in 0install | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nick Sabalausky | On 2013-06-11 08:38, Nick Sabalausky wrote: > I just tried both on Debian 6: > > nick@debian6:~$ cat 1< /dev/null > cfws > cat: write error: Bad file descriptor > nick@debian6:~$ echo meh 1< /dev/null > bash: echo: write error: Bad file descriptor > > Maybe OSX behaves differently? I get the same on Mac OS X 10.6.3 using bash. Is Andrei perhaps using another shell? -- /Jacob Carlborg |
June 11, 2013 Re: reddit discussion on replacing Python in 0install | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | On Tue, 11 Jun 2013 09:09:43 +0200
Jacob Carlborg <doob@me.com> wrote:
> On 2013-06-11 08:38, Nick Sabalausky wrote:
>
> > I just tried both on Debian 6:
> >
> > nick@debian6:~$ cat 1< /dev/null
> > cfws
> > cat: write error: Bad file descriptor
> > nick@debian6:~$ echo meh 1< /dev/null
> > bash: echo: write error: Bad file descriptor
> >
> > Maybe OSX behaves differently?
>
> I get the same on Mac OS X 10.6.3 using bash. Is Andrei perhaps using another shell?
>
I think I remember him saying somewhere that he uses zsh, although I can't look it up or test it on zsh at the moment.
|
June 11, 2013 Re: reddit discussion on replacing Python in 0install | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nick Sabalausky | On Tuesday, 11 June 2013 at 10:55:16 UTC, Nick Sabalausky wrote:
> On Tue, 11 Jun 2013 09:09:43 +0200
> Jacob Carlborg <doob@me.com> wrote:
>
>> On 2013-06-11 08:38, Nick Sabalausky wrote:
>>
>> > I just tried both on Debian 6:
>> >
>> > nick@debian6:~$ cat 1< /dev/null
>> > cfws
>> > cat: write error: Bad file descriptor
>> > nick@debian6:~$ echo meh 1< /dev/null
>> > bash: echo: write error: Bad file descriptor
>> >
>> > Maybe OSX behaves differently?
>>
>> I get the same on Mac OS X 10.6.3 using bash. Is Andrei perhaps using another shell?
>>
>
> I think I remember him saying somewhere that he uses zsh, although I
> can't look it up or test it on zsh at the moment.
Just tried zsh, bash, sh..
$ echo meh 1< /dev/null
zsh: no output
bash: Bad file descriptor
sh: Bad file descriptor
$ echo meh 2< /dev/null
zsh: meh
bash: meh
sh: meh
|
Copyright © 1999-2021 by the D Language Foundation