From faber at linuxnj.com Sun Apr 16 19:02:24 2006 From: faber at linuxnj.com (Faber Fedor) Date: Sun, 16 Apr 2006 22:02:24 -0400 Subject: [ABE.pm] Ruby Q Message-ID: <20060417020224.GA22840@neptune.faber.nom> (Yes, that's Creedence you hear in the background.) I finally started playing with Ruby. So far, so good. However, in my readings, there's one important (IMO) thing I haven't come across: what is Ruby's equivalent to Perl's "my" declaration? I *really* hate creating variables by mistyping. -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com From rjbs-perl-abe at lists.manxome.org Sun Apr 16 19:11:00 2006 From: rjbs-perl-abe at lists.manxome.org (Ricardo SIGNES) Date: Sun, 16 Apr 2006 22:11:00 -0400 Subject: [ABE.pm] Ruby Q In-Reply-To: <20060417020224.GA22840@neptune.faber.nom> References: <20060417020224.GA22840@neptune.faber.nom> Message-ID: <20060417021100.GR17788@manxome.org> * Faber Fedor [2006-04-16T22:02:24] > I finally started playing with Ruby. So far, so good. However, in my > readings, there's one important (IMO) thing I haven't come across: what > is Ruby's equivalent to Perl's "my" declaration? > > I *really* hate creating variables by mistyping. Tough luck. Ruby's variables are created by assignment. Using a symbol as an rvalue in an expression before it's been assigned a value throws a NameError, just like Python. Ruby's scoping is more sane than Python's, but you can still shoot your foot more easily than in Perl, with regard to undeclared variables and typos. I'm with you: it's one of the few places where, as a language, Perl 5 beats Ruby. -- rjbs -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://mail.pm.org/pipermail/abe-pm/attachments/20060416/fd194019/attachment.bin From faber at linuxnj.com Mon Apr 17 14:00:49 2006 From: faber at linuxnj.com (Faber Fedor) Date: Mon, 17 Apr 2006 17:00:49 -0400 Subject: [ABE.pm] Ruby Q In-Reply-To: <20060417021100.GR17788@manxome.org> References: <20060417020224.GA22840@neptune.faber.nom> <20060417021100.GR17788@manxome.org> Message-ID: <20060417210049.GC24706@neptune.faber.nom> On 16/04/06 22:11 -0400, Ricardo SIGNES wrote: > * Faber Fedor [2006-04-16T22:02:24] > > I finally started playing with Ruby. So far, so good. However, in my > > readings, there's one important (IMO) thing I haven't come across: what > > is Ruby's equivalent to Perl's "my" declaration? > > > > I *really* hate creating variables by mistyping. > > Tough luck. Ruby's variables are created by assignment. Using a symbol as > an rvalue in an expression before it's been assigned a value throws a > NameError, just like Python. That I can live with. It's the unintended lvalues that I don't want. > Ruby's scoping is more sane than Python's, but > you can still shoot your foot more easily than in Perl, Hmm, I assumed the scoping would be Perl-like. I'd better read up on that. -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com From rjbs-perl-abe at lists.manxome.org Mon Apr 17 14:20:52 2006 From: rjbs-perl-abe at lists.manxome.org (Ricardo SIGNES) Date: Mon, 17 Apr 2006 17:20:52 -0400 Subject: [ABE.pm] Ruby Q In-Reply-To: <20060417210049.GC24706@neptune.faber.nom> References: <20060417020224.GA22840@neptune.faber.nom> <20060417021100.GR17788@manxome.org> <20060417210049.GC24706@neptune.faber.nom> Message-ID: <20060417212052.GA3919@manxome.org> * Faber Fedor [2006-04-17T17:00:49] > On 16/04/06 22:11 -0400, Ricardo SIGNES wrote: > > Ruby's scoping is more sane than Python's, but > > you can still shoot your foot more easily than in Perl, > > Hmm, I assumed the scoping would be Perl-like. I'd better read up on > that. The unPerl-like-ness-itude of it is that "a variable's scope begins at the point where its symbol is assigned to" rather than "a variable's scope begins when it is declared to begin." -- rjbs -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 186 bytes Desc: not available Url : http://mail.pm.org/pipermail/abe-pm/attachments/20060417/db3a7762/attachment.bin From faber at linuxnj.com Tue Apr 18 19:44:38 2006 From: faber at linuxnj.com (Faber Fedor) Date: Tue, 18 Apr 2006 22:44:38 -0400 Subject: [ABE.pm] Ruby Q In-Reply-To: <20060417212052.GA3919@manxome.org> References: <20060417020224.GA22840@neptune.faber.nom> <20060417021100.GR17788@manxome.org> <20060417210049.GC24706@neptune.faber.nom> <20060417212052.GA3919@manxome.org> Message-ID: <20060419024438.GA28791@neptune.faber.nom> On 17/04/06 17:20 -0400, Ricardo SIGNES wrote: > * Faber Fedor [2006-04-17T17:00:49] > > On 16/04/06 22:11 -0400, Ricardo SIGNES wrote: > > > Ruby's scoping is more sane than Python's, but > > > you can still shoot your foot more easily than in Perl, > > > > Hmm, I assumed the scoping would be Perl-like. I'd better read up on > > that. > > The unPerl-like-ness-itude of it is that "a variable's scope begins at the > point where its symbol is assigned to" rather than "a variable's scope begins > when it is declared to begin." Well, that makes sense if you can't declare the variable, i.e. the variable is declared once it is assigned. What am I missing? -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com From rjbs-perl-abe at lists.manxome.org Tue Apr 18 20:05:34 2006 From: rjbs-perl-abe at lists.manxome.org (Ricardo SIGNES) Date: Tue, 18 Apr 2006 23:05:34 -0400 Subject: [ABE.pm] Ruby Q In-Reply-To: <20060419024438.GA28791@neptune.faber.nom> References: <20060417020224.GA22840@neptune.faber.nom> <20060417021100.GR17788@manxome.org> <20060417210049.GC24706@neptune.faber.nom> <20060417212052.GA3919@manxome.org> <20060419024438.GA28791@neptune.faber.nom> Message-ID: <20060419030534.GA20576@manxome.org> * Faber Fedor [2006-04-18T22:44:38] > > The unPerl-like-ness-itude of it is that "a variable's scope begins at the > > point where its symbol is assigned to" rather than "a variable's scope > > begins when it is declared to begin." > > Well, that makes sense if you can't declare the variable, i.e. the > variable is declared once it is assigned. What am I missing? scratchpad_value = 10 # default starting user_input.each { |datum| analysis = MegaWidget.analyze_datum(datum) summary = Reporter.crunch_numbers(analysis) scratchpad_valuw = Reporter.average_in(summary, scratchpad_value) } puts "the final output is #{scratchpad_value}" In Perl, you would have put "my" in front of only the first assignment to scratchpad_value, so the assignment to scratchpad_valuw would have been a compile-time error. In Ruby, its assignment declares it, but is pointless. The final output is always 10 and no exception is raised. -- rjbs -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://mail.pm.org/pipermail/abe-pm/attachments/20060418/21638572/attachment.bin From rjbs-perl-abe at lists.manxome.org Thu Apr 27 08:09:05 2006 From: rjbs-perl-abe at lists.manxome.org (Ricardo SIGNES) Date: Thu, 27 Apr 2006 11:09:05 -0400 Subject: [ABE.pm] good grief, we need beer Message-ID: <20060427150904.GQ30945@zodiac.codesimply.com> Mongers: I should really try to settle some regular period for beer meetings. If nobody could make it, I'd still get beer. If people could make it, I'd get beer with cool people. Yup, beer sounds like a good plan. I will be drinking beer (and eating dinner) next Wednesday, May 3rd, at J.P. McGrady's, around 18:30. John will be there, too, in case you don't like me. I will look forward to talking about Perl, Ruby, Linux, and other stuff. Faber, if you feel like coming, I might ask you questions about business... stuff. ALSO! I'm going to be giving a talk on one of my favorite new projects at YAPC this year. (Anybody else going to go? It's cheap!) It'd be great if I could get some of you guys to let me practice it between now and YAPC. See you then? -- rjbs -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://mail.pm.org/pipermail/abe-pm/attachments/20060427/fbb2307e/attachment.bin From faber at linuxnj.com Thu Apr 27 08:27:08 2006 From: faber at linuxnj.com (Faber Fedor) Date: Thu, 27 Apr 2006 11:27:08 -0400 Subject: [ABE.pm] good grief, we need beer In-Reply-To: <20060427150904.GQ30945@zodiac.codesimply.com> References: <20060427150904.GQ30945@zodiac.codesimply.com> Message-ID: <20060427152708.GA19657@neptune.faber.nom> On 27/04/06 11:09 -0400, Ricardo SIGNES wrote: > Mongers: > > I should really try to settle some regular period for beer meetings. If nobody > could make it, I'd still get beer. If people could make it, I'd get beer with > cool people. Yup, beer sounds like a good plan. > > I will be drinking beer (and eating dinner) next Wednesday, May 3rd, at J.P. > McGrady's, around 18:30. John will be there, too, in case you don't like me. > I will look forward to talking about Perl, Ruby, Linux, and other stuff. > > Faber, if you feel like coming, I might ask you questions about business... > stuff. First Wednesday of the month looks good for me. This is the same place we were at before? > ALSO! I'm going to be giving a talk on one of my favorite new projects at YAPC > this year. (Anybody else going to go? It's cheap!) When and where? > It'd be great if I could > get some of you guys to let me practice it between now and YAPC. Can't you get those LVLUGers to let you talk? -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com From rjbs-perl-abe at lists.manxome.org Thu Apr 27 08:31:06 2006 From: rjbs-perl-abe at lists.manxome.org (Ricardo SIGNES) Date: Thu, 27 Apr 2006 11:31:06 -0400 Subject: [ABE.pm] good grief, we need beer In-Reply-To: <20060427152708.GA19657@neptune.faber.nom> References: <20060427150904.GQ30945@zodiac.codesimply.com> <20060427152708.GA19657@neptune.faber.nom> Message-ID: <20060427153106.GR30945@zodiac.codesimply.com> * Faber Fedor [2006-04-27T11:27:08] > > I will be drinking beer (and eating dinner) next Wednesday, May 3rd, at > > J.P. McGrady's, around 18:30. John will be there, too, in case you don't > > like me. > > First Wednesday of the month looks good for me. This is the same place > we were at before? Yes! Mmm. Beer, burgers, wings. > > ALSO! I'm going to be giving a talk on one of my favorite new projects at > > YAPC this year. (Anybody else going to go? It's cheap!) > > When and where? http://yapcchicago.org It's in (duh) Chicago, June 26-28. Registration is $85. The cheap on-site lodging is about $100/night. This looks like one of the best YAPCs in years, so I'm excited. > > It'd be great if I could > > get some of you guys to let me practice it between now and YAPC. > > Can't you get those LVLUGers to let you talk? I can, and I might try for both... but the code I'm presenting on is fairly non-beginner-friendly. -- rjbs -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://mail.pm.org/pipermail/abe-pm/attachments/20060427/98c77250/attachment.bin