Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-28 Thread Rick Johnson
On Wednesday, March 28, 2018 at 2:25:42 AM UTC-5, Gregory Ewing wrote: > Rick Johnson wrote: > > The only difference is when you want to make a call from a > > _reference_, which, as you and i well know, is not the > > most common way func/meths are called (these are rare). > > No, but it's the ca

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-28 Thread Chris Angelico
On Thu, Mar 29, 2018 at 12:28 AM, Steven D'Aprano wrote: > On Tue, 27 Mar 2018 11:34:17 +1100, Chris Angelico wrote: > >> Question: How do you get a reference to a Ruby function? Or are they not >> first-class objects? > > https://stackoverflow.com/questions/4294485/how-do-i-reference-a-function-

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-28 Thread Steven D'Aprano
On Tue, 27 Mar 2018 11:34:17 +1100, Chris Angelico wrote: > Question: How do you get a reference to a Ruby function? Or are they not > first-class objects? https://stackoverflow.com/questions/4294485/how-do-i-reference-a-function- in-ruby Especially this answer, which is worth reading: https://

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-28 Thread Gregory Ewing
Rick Johnson wrote: The only difference is when you want to make a call from a _reference_, which, as you and i well know, is not the most common way func/meths are called (these are rare). No, but it's the case we're talking about here. If functions don't behave the same way in all circumstanc

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-27 Thread Chris Angelico
On Wed, Mar 28, 2018 at 1:22 PM, Rick Johnson wrote: > On Tuesday, March 27, 2018 at 6:55:23 PM UTC-5, Steven D'Aprano wrote: >> On Tue, 27 Mar 2018 09:28:34 -0700, Rick Johnson wrote: > [...] >> > Since when did utilizing a method to request a specific >> > value become some sort of magic? >> >>

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-27 Thread Rick Johnson
On Tuesday, March 27, 2018 at 6:55:23 PM UTC-5, Steven D'Aprano wrote: > On Tue, 27 Mar 2018 09:28:34 -0700, Rick Johnson wrote: [...] > > Since when did utilizing a method to request a specific > > value become some sort of magic? > > Since it requires a special method that has super powers no > m

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-27 Thread Steven D'Aprano
On Tue, 27 Mar 2018 09:28:34 -0700, Rick Johnson wrote: > On Tuesday, March 27, 2018 at 8:46:54 AM UTC-5, Chris Angelico wrote: [...] > > Cool, so Greg was right: you can't get a reference to a method or > > function. You need magic to simulate it. > > Since when did utilizing a method to request a

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-27 Thread Rick Johnson
On Tuesday, March 27, 2018 at 4:47:05 PM UTC-5, Gregory Ewing wrote: > Rick Johnson wrote: > > rb> Object.method("print_name").call("Meathead") > > Yes, but the point is that you have to have to use a different > syntax to call it. This is like having to say > > f.__call__(arg) > > in Pytho

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-27 Thread Gregory Ewing
Rick Johnson wrote: rb> Object.method("print_name").call("Meathead") Yes, but the point is that you have to have to use a different syntax to call it. This is like having to say f.__call__(arg) in Python instead of just f(arg) -- Greg -- https://mail.python.org/mailman/listinfo/py

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-27 Thread Gregory Ewing
Chris Angelico wrote: Ahh, that explains it. Great. So how do you build higher-order functions? Or don't you? You don't, exactly. You have to pass around objects with a method to invoke when you want to "call" them. Ruby has a code-block syntax that helps with this somewhat, but I don't think

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-27 Thread Rick Johnson
On Tuesday, March 27, 2018 at 11:35:31 AM UTC-5, Chris Angelico wrote: > Why are you suggesting that this is magic? _You_ are the one who leveled the accusation that Ruby's methodology for fetching a function reference (a la): Object.method(meth-name-here) is "magic". I'm merely requesting t

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-27 Thread Chris Angelico
On Wed, Mar 28, 2018 at 3:28 AM, Rick Johnson wrote: > On Tuesday, March 27, 2018 at 8:46:54 AM UTC-5, Chris Angelico wrote: > [...] >> Cool, so Greg was right: you can't get a reference to a >> method or function. You need magic to simulate it. > > Since when did utilizing a method to request a s

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-27 Thread Rick Johnson
On Tuesday, March 27, 2018 at 8:46:54 AM UTC-5, Chris Angelico wrote: [...] > Cool, so Greg was right: you can't get a reference to a > method or function. You need magic to simulate it. Since when did utilizing a method to request a specific value become some sort of magic? Do you consider this

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-27 Thread Chris Angelico
On Tue, Mar 27, 2018 at 11:00 PM, Rick Johnson wrote: > On Tuesday, March 27, 2018 at 1:55:01 AM UTC-5, Gregory Ewing wrote: >> Chris Angelico wrote: >> > Question: How do you get a reference to a Ruby function? Or are they >> > not first-class objects? >> >> They're not first-class. So, you can't

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-27 Thread Rick Johnson
On Tuesday, March 27, 2018 at 3:24:48 AM UTC-5, Steven D'Aprano wrote: > On Mon, 26 Mar 2018 11:37:35 -0700, Rick Johnson wrote: > Printing a string and calling a function is obfuscated code? Deary me. When the programmer can't be bothered to invent names more descriptive than `a` and `b`, why ye

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-27 Thread Rick Johnson
On Tuesday, March 27, 2018 at 1:55:01 AM UTC-5, Gregory Ewing wrote: > Chris Angelico wrote: > > Question: How do you get a reference to a Ruby function? Or are they > > not first-class objects? > > They're not first-class. So, you can't. If Chris means: "how do you get a reference to a Ruby funct

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-27 Thread Steven D'Aprano
On Mon, 26 Mar 2018 11:37:35 -0700, Rick Johnson wrote: > On Monday, March 26, 2018 at 5:46:03 AM UTC-5, Steven D'Aprano wrote: >> Rick, you're supposedly familiar with Ruby. And yet, you didn't notice >> that your supposed "fix" didn't touch any executable code, all it did >> was modify the strin

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-27 Thread Stephen Hansen
On Mon, Mar 26, 2018, at 2:19 PM, Rick Johnson wrote: >Sure, the behavior that Steven > uncovered is odd, but it could be that Maz harbors a strong > disliking for undisciplined pupils, and thus, he designed > and placed this little trap in the hopes the pain it induced > might encourage the petula

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-27 Thread Chris Angelico
On Tue, Mar 27, 2018 at 5:54 PM, Gregory Ewing wrote: > Chris Angelico wrote: >> >> Question: How do you get a reference to a Ruby function? Or are they >> not first-class objects? > > > They're not first-class. So, you can't. > Ahh, that explains it. Great. So how do you build higher-order funct

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-26 Thread Gregory Ewing
Chris Angelico wrote: Question: How do you get a reference to a Ruby function? Or are they not first-class objects? They're not first-class. So, you can't. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-26 Thread Gregory Ewing
Ned Batchelder wrote: "Ranting Rick" isn't trying to enlighten, educate, or learn. He's trying to rile people up, and he is good at it. I don't think he's even trying, it just come naturally to him. Rick rants the way wind blows and water wets. -- Greg -- https://mail.python.org/mailman/listi

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-26 Thread Rick Johnson
On Monday, March 26, 2018 at 6:11:31 PM UTC-5, Python wrote: > On Mon, Mar 26, 2018 at 02:19:12PM -0700, Rick Johnson wrote: [...] > > Hmm. If "syntax parser rules" could prevent poorly > > formatted code, then there'd be no need for style guides. > > It may be telling that my team has minimal styl

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-26 Thread Chris Angelico
On Tue, Mar 27, 2018 at 10:10 AM, Python wrote: > Ruby touts itself as being a simple language with elegant syntax. > This thread is my only exposure to it to date, but what I've seen here > is, frankly, the exact opposite of that. You should not need a map to > distinguish function calls from va

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-26 Thread Ned Batchelder
On 3/26/18 7:10 PM, Python wrote: Humans are already good enough at making mistakes that they require no additional encouragement, such as what is provided by allowing such syntactical horrors. Agreed. And that's why we must respect and follow the code styling wisdom which has been passed down b

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-26 Thread Python
On Mon, Mar 26, 2018 at 02:19:12PM -0700, Rick Johnson wrote: > On Monday, March 26, 2018 at 3:09:38 PM UTC-5, Python wrote: > > On Mon, Mar 26, 2018 at 11:37:35AM -0700, Rick Johnson wrote: > [...] > > > Ruby followed the rules. > > > But you didn't. > > > > Nonsense... Your language's syntax pars

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-26 Thread Rick Johnson
On Monday, March 26, 2018 at 3:09:38 PM UTC-5, Python wrote: > On Mon, Mar 26, 2018 at 11:37:35AM -0700, Rick Johnson wrote: [...] > > Ruby followed the rules. > > But you didn't. > > Nonsense... Your language's syntax parser is what defines > the rules. All of the expressions Stephen wrote did not

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-26 Thread Python
On Mon, Mar 26, 2018 at 11:37:35AM -0700, Rick Johnson wrote: > > Because of this "fix", the printed strings no longer match > > the code being executed, but the strange, inconsistent > > behaviour still occurs. > > The supposed "inconsistent behavior" here has absolutely > nothing to do with Ruby

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-26 Thread Chris Angelico
On Tue, Mar 27, 2018 at 5:37 AM, Rick Johnson wrote: > The supposed "inconsistent behavior" here has absolutely > nothing to do with Ruby, no, it's all on _you_. _YOU_ are > the one who created a non-sensical function with a single > char name; and _YOU_ are the one who placed a call to that > fun

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-26 Thread Python
On Mon, Mar 26, 2018 at 10:43:32AM +, Steven D'Aprano wrote: > The kicker is that out of these four legal, parenthesis-free ways of > calling function a, *three* of them interpret the expression as: > > call a with no arguments > then add b using the binary plus operator > > but the

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-26 Thread Python
On Sun, Mar 25, 2018 at 10:33:49AM -0700, Rick Johnson wrote: > > [steve@ando ruby]$ ruby ws-example.rb > > a + b => 7 > > a+b => 7 > > a+ b => 7 > > a +b => 3 > > > > Here's the source code: > > > > # --- cut --- > > def a(x=4) > > x+2 > > end > > > > b = 1 > > print "a + b => ", (a + b),

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-26 Thread Rick Johnson
On Monday, March 26, 2018 at 5:46:03 AM UTC-5, Steven D'Aprano wrote: > Rick, you're supposedly familiar with Ruby. And yet, you > didn't notice that your supposed "fix" didn't touch any > executable code, all it did was modify the strings being > printed. Because the goal was to *UN-OBFUSCATE* th

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-26 Thread Steven D'Aprano
On Sun, 25 Mar 2018 19:16:12 -0700, Rick Johnson wrote: > On Sunday, March 25, 2018 at 5:57:28 PM UTC-5, Steven D'Aprano wrote: > >> [supposed "fix" to the sample script snipped] >> >> You know Rick, every time I start to think that talking to you like an >> adult might result in a productive and

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-25 Thread Rick Johnson
On Sunday, March 25, 2018 at 5:57:28 PM UTC-5, Steven D'Aprano wrote: > [supposed "fix" to the sample script snipped] > > You know Rick, every time I start to think that talking to > you like an adult might result in a productive and > intelligent conversation, you pull a stunt like this. Once >

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-25 Thread Steven D'Aprano
On Sun, 25 Mar 2018 10:33:49 -0700, Rick Johnson wrote: > On Sunday, March 25, 2018 at 9:11:35 AM UTC-5, Steven D'Aprano wrote: >> On Sun, 25 Mar 2018 04:49:21 -0700, Rick Johnson wrote: > [...] >> I never said anything about not allowing it. But since you've gone on >> the defence about parens-fr

Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-25 Thread Rick Johnson
On Sunday, March 25, 2018 at 9:11:35 AM UTC-5, Steven D'Aprano wrote: > On Sun, 25 Mar 2018 04:49:21 -0700, Rick Johnson wrote: [...] > I never said anything about not allowing it. But since > you've gone on the defence about parens-free function > calls, how is this for "consistency" in Ruby? > >

Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-25 Thread Steven D'Aprano
On Sun, 25 Mar 2018 04:49:21 -0700, Rick Johnson wrote: >> - with no arguments, using the parenthesis-free syntax, >> Ruby automagically forwards the same arguments to the (single) >> parent; > > Which is merely a natural result of Ruby's function/method call syntax. > Not allowing a parenthe