[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: A little idiom I like

Berger, Daniel

9/6/2006 5:48:00 PM

> -----Original Message-----
> From: Austin Ziegler [mailto:halostatue@gmail.com]
> Sent: Wednesday, September 06, 2006 11:15 AM
> To: ruby-talk ML
> Subject: Re: A little idiom I like
>
>
> On 9/4/06, Hal Fulton <hal9000@hypermetrics.com> wrote:
> > Rick DeNatale wrote:
> >> No easily, even if you can figure out how to define a
> method named \
> >> or "\\" it's going to be messy sending it.
> > If we're seriously talking about a Windows usage, let me point out
> > that it's only on the command line that \ is needed.
>
> Mostly.
>
> > Internally, WIndows paths can use ordinary slashes (in
> every case I'm
> > familiar with).
>
> Mostly.
>
> The reality of the matter is that with the APIs that Ruby is
> currently using -- which are problematic for certain cases
> (Unicode) -- the \ and / are interchangeable internally.
>
> The advanced APIs -- the Unicode ones and the ones that make
> it possible to have very long path names -- requires \.
>
> -austin

Indeed. This is why all paths generated using the pathname2 package
convert all forward slashes to backslashes. Also, the various PathXXX
functions do NOT work with forward slashes.

To wit:

irb(main):001:0> require 'Win32API'
=> true
irb(main):002:0> PathIsRoot = Win32API.new('shlwapi', 'PathIsRoot', 'P',
'I')
=> #<Win32API:0x2c17be8>
irb(main):003:0> PathIsRoot.call("C:\\")
=> 1
irb(main):004:0> PathIsRoot.call("C:/")
=> 0

Regards,

Dan


This communication is the property of Qwest and may contain confidential or
privileged information. Unauthorized use of this communication is strictly
prohibited and may be unlawful. If you have received this communication
in error, please immediately notify the sender by reply e-mail and destroy
all copies of the communication and any attachments.

12 Answers

Rick DeNatale

9/6/2006 9:17:00 PM

0

On 9/6/06, Berger, Daniel <Daniel.Berger@qwest.com> wrote:

>
> Indeed. This is why all paths generated using the pathname2 package
> convert all forward slashes to backslashes. Also, the various PathXXX
> functions do NOT work with forward slashes.

If only Gary Kildall had not decided to use / instead of - for
parameter markers in CP/M, so that it wasn't taken when directories
were added. I'm pretty sure that he's the one to blame, or did it come
from one of the DEC operating systems he used as a model for the
'shell?'

--
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denh...

Hal E. Fulton

9/6/2006 10:57:00 PM

0

Rick DeNatale wrote:
> On 9/6/06, Berger, Daniel <Daniel.Berger@qwest.com> wrote:
>
>>
>> Indeed. This is why all paths generated using the pathname2 package
>> convert all forward slashes to backslashes. Also, the various PathXXX
>> functions do NOT work with forward slashes.
>
>
> If only Gary Kildall had not decided to use / instead of - for
> parameter markers in CP/M, so that it wasn't taken when directories
> were added. I'm pretty sure that he's the one to blame, or did it come
> from one of the DEC operating systems he used as a model for the
> 'shell?'

Interesting question. I always assumed the /x notation
came to DOS by way of CP/M, but now I recall that it
was also in TOPS10.

And yes, that was a looong time ago. My keychain has
2000 times as much memory as the college mainframe
had then.


Hal




Austin Ziegler

9/7/2006 1:53:00 AM

0

On 9/6/06, Berger, Daniel <Daniel.Berger@qwest.com> wrote:
> Indeed. This is why all paths generated using the pathname2 package
> convert all forward slashes to backslashes. Also, the various PathXXX
> functions do NOT work with forward slashes.

Inasmuch as is possible, where Ruby provides these, it should hide
this distinction. I would hate to have to enter \\ every time I wanted
to put two files together. (It would also increase the mismatch
between Ruby Windows and everywhere else, so the more we can hide that
the more portable we make Ruby.)

-austin
--
Austin Ziegler * halostatue@gmail.com * http://www.halo...
* austin@halostatue.ca * http://www.halo...feed/
* austin@zieglers.ca

M. Edward (Ed) Borasky

9/7/2006 2:40:00 AM

0

Hal Fulton wrote:
> Rick DeNatale wrote:
>> On 9/6/06, Berger, Daniel <Daniel.Berger@qwest.com> wrote:
>>
>>>
>>> Indeed. This is why all paths generated using the pathname2 package
>>> convert all forward slashes to backslashes. Also, the various PathXXX
>>> functions do NOT work with forward slashes.
>>
>>
>> If only Gary Kildall had not decided to use / instead of - for
>> parameter markers in CP/M, so that it wasn't taken when directories
>> were added. I'm pretty sure that he's the one to blame, or did it come
>> from one of the DEC operating systems he used as a model for the
>> 'shell?'
>
> Interesting question. I always assumed the /x notation
> came to DOS by way of CP/M, but now I recall that it
> was also in TOPS10.
>
> And yes, that was a looong time ago. My keychain has
> 2000 times as much memory as the college mainframe
> had then.
>
>
> Hal
>
>
>
>
>
And VMS and RSX-11. My recollection is that CP-M command line syntax in
fact descends from RSX-11 and/or RT-11, so it's not surprising.

Mike Dvorkin

9/7/2006 5:12:00 AM

0

Don't think it was DEC. On PDP-11/RSX and VAX/VMS directories were
enclosed in square brackets, something like SY:[0,1] or DUA0:[SYS
$ROOT.DIR.SUBDIR], always with unique [ ] delimiters.

Best,
Mike Dvorkin
http://www.rubyw...


On Sep 6, 2006, at 2:16 PM, Rick DeNatale wrote:

> On 9/6/06, Berger, Daniel <Daniel.Berger@qwest.com> wrote:
>
>>
>> Indeed. This is why all paths generated using the pathname2 package
>> convert all forward slashes to backslashes. Also, the various
>> PathXXX
>> functions do NOT work with forward slashes.
>
> If only Gary Kildall had not decided to use / instead of - for
> parameter markers in CP/M, so that it wasn't taken when directories
> were added. I'm pretty sure that he's the one to blame, or did it come
> from one of the DEC operating systems he used as a model for the
> 'shell?'
>
> --
> Rick DeNatale
>
> My blog on Ruby
> http://talklikeaduck.denh...
>


Hal E. Fulton

9/7/2006 5:29:00 AM

0

Mike Dvorkin wrote:
> Don't think it was DEC. On PDP-11/RSX and VAX/VMS directories were
> enclosed in square brackets, something like SY:[0,1] or DUA0:[SYS
> $ROOT.DIR.SUBDIR], always with unique [ ] delimiters.

Yes, the brackets were used that way... but Rick was talking
about the use of slashes for switches (the way Unix uses the
hyphen). That's a DECism, though it may have come from
elsewhere -- as in KJOB /F or simply K/F


Hal


> Best,
> Mike Dvorkin
> http://www.rubyw...
>
>
> On Sep 6, 2006, at 2:16 PM, Rick DeNatale wrote:
>
>> On 9/6/06, Berger, Daniel <Daniel.Berger@qwest.com> wrote:
>>
>>>
>>> Indeed. This is why all paths generated using the pathname2 package
>>> convert all forward slashes to backslashes. Also, the various PathXXX
>>> functions do NOT work with forward slashes.
>>
>>
>> If only Gary Kildall had not decided to use / instead of - for
>> parameter markers in CP/M, so that it wasn't taken when directories
>> were added. I'm pretty sure that he's the one to blame, or did it come
>> from one of the DEC operating systems he used as a model for the
>> 'shell?'
>>
>> --
>> Rick DeNatale
>>
>> My blog on Ruby
>> http://talklikeaduck.denh...
>>
>
>


M. Edward (Ed) Borasky

9/7/2006 5:34:00 AM

0

Mike Dvorkin wrote:
> Don't think it was DEC. On PDP-11/RSX and VAX/VMS directories were
> enclosed in square brackets, something like SY:[0,1] or
> DUA0:[SYS$ROOT.DIR.SUBDIR], always with unique [ ] delimiters.
>
> Best,
> Mike Dvorkin
> http://www.rubyw...
>
>
> On Sep 6, 2006, at 2:16 PM, Rick DeNatale wrote:
>
>> On 9/6/06, Berger, Daniel <Daniel.Berger@qwest.com> wrote:
>>
>>>
>>> Indeed. This is why all paths generated using the pathname2 package
>>> convert all forward slashes to backslashes. Also, the various PathXXX
>>> functions do NOT work with forward slashes.
>>
>> If only Gary Kildall had not decided to use / instead of - for
>> parameter markers in CP/M, so that it wasn't taken when directories
>> were added. I'm pretty sure that he's the one to blame, or did it come
>> from one of the DEC operating systems he used as a model for the
>> 'shell?'
>>
>> --Rick DeNatale
>>
>> My blog on Ruby
>> http://talklikeaduck.denh...
>>
>
>
>
Yes, and the forward slash was used to designate options.

Mike Dvorkin

9/7/2006 5:47:00 AM

0

Ahh, yes, it's pure DCL thingie carried all they way to cmd.exe. They
called it command qualifiers back then :-).

Best,
Mike Dvorkin
http://www.rubyw...

On Sep 6, 2006, at 10:28 PM, Hal Fulton wrote:

> Mike Dvorkin wrote:
>> Don't think it was DEC. On PDP-11/RSX and VAX/VMS directories
>> were enclosed in square brackets, something like SY:[0,1] or DUA0:
>> [SYS $ROOT.DIR.SUBDIR], always with unique [ ] delimiters.
>
> Yes, the brackets were used that way... but Rick was talking
> about the use of slashes for switches (the way Unix uses the
> hyphen). That's a DECism, though it may have come from
> elsewhere -- as in KJOB /F or simply K/F
>
>
> Hal
>
>
>> Best,
>> Mike Dvorkin
>> http://www.rubyw...
>> On Sep 6, 2006, at 2:16 PM, Rick DeNatale wrote:
>>> On 9/6/06, Berger, Daniel <Daniel.Berger@qwest.com> wrote:
>>>
>>>>
>>>> Indeed. This is why all paths generated using the pathname2
>>>> package
>>>> convert all forward slashes to backslashes. Also, the various
>>>> PathXXX
>>>> functions do NOT work with forward slashes.
>>>
>>>
>>> If only Gary Kildall had not decided to use / instead of - for
>>> parameter markers in CP/M, so that it wasn't taken when directories
>>> were added. I'm pretty sure that he's the one to blame, or did it
>>> come
>>> from one of the DEC operating systems he used as a model for the
>>> 'shell?'
>>>
>>> --
>>> Rick DeNatale
>>>
>>> My blog on Ruby
>>> http://talklikeaduck.denh...
>>>
>
>


Trans

9/7/2006 2:42:00 PM

0

I recollect an old OS called COS (Cobol Operating System?) That
actually used dot notation to separate directories. Now if only that
would have caught on and our object systems and file system could have
become seemless entiites. He he. I'm dreaming...


Rick DeNatale

9/7/2006 8:40:00 PM

0

On 9/7/06, Trans <transfire@gmail.com> wrote:
> I recollect an old OS called COS (Cobol Operating System?) That
> actually used dot notation to separate directories. Now if only that
> would have caught on and our object systems and file system could have
> become seemless entiites. He he. I'm dreaming...

Then of course there was a family of operating systems which started
in the 1960s from a little known computer company named with three
letters like HAL, or JCN, or something like that that used /'s
extensively in it's "shell" language, something like

//STEP1 EXEC PGM=IEBCOPY
//SYSIN DD *
THIS IS SOME DATA
/*
//SYSOUT DD DSN="FRED"

Which was sort of like the equivalent of $cat >FRED

T'was something like that, the memory fades away.

--
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denh...