From: Rick DeNatale Date: 2006-09-04T12:06:42+09:00 Subject: Re: A little idiom I like On 9/3/06, M. Edward (Ed) Borasky wrote: > Rick DeNatale wrote: > > On 9/1/06, Hal Fulton wrote: > >> Here's a little something I like. YMMV. > >> > >> Hal > >> > >> > >> require 'pathname' > >> > >> class Pathname > >> alias / + > >> end > >> > >> home = Pathname.new("/home/hal") > >> proj = home/"projects" > >> foo = home/"projects/foobar" > >> > >> > > > > Those poor Windows guys. > > > > irb(main):017:0> class Pathname > > irb(main):018:1> alias \ + > > irb(main):019:1* end > > SyntaxError: compile error > > (irb):18: parse error, unexpected $undefined. > > alias \ + > > ^ > > from (irb):19 > > from :0 > > irb(main):020:0> > > > > There's a workaround, right? Some combination of other quotes and double > backslashes? The R people get around it by using forward slashes > internally and only converting to backslashes when going out to a > Windows call that needs them. Even so, there was one thing I never did > figure out how to do in R, and ended up starting R up in the right > directory at the beginning of the session. :) No easily, even if you can figure out how to define a method named \ or "\\" it's going to be messy sending it. -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/ IPMS/USA Region 12 Coordinator http://ipmsr12.denhaven2.com/ Visit the Project Mercury Wiki Site http://www.mercuryspacecraft.com/