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 parenthesis-free super call would not only be > inconsistent, it would be foolishly inconsistent.
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? [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), "\n" print "a+b => ", (a+b), "\n" print "a+ b => ", (a+ b), "\n" print "a +b => ", (a +b), "\n" # --- cut --- >> So there's weird magic going on where `super` and `super()` both call >> the method but with different arguments. Ewww. > > It's only weird because you are judging through a Python lens. Ruby is > not Python. And Python is not Ruby. No, its weird because in *both cases* there are no arguments given, but in one case there are no arguments passed, but in the other case, some unknown number of invisible arguments are passed. Consider a bunch of Ruby function calls: f() # calls f with no arguments f # calls f with no arguments foo() # calls foo with no arguments foo # calls foo with no arguments bar() # calls bar with no arguments bar # calls bar with no arguments super() # calls the superclass method with no arguments super # MAGIC HAPPENS! calls the superclass method with some unknown number of arguments! If you want to argue that's a useful feature, okay, I'll give you the benefit of the doubt. But useful or not, it's still weird and surprising. And deeply, fundamentally inconsistent. -- Steve -- https://mail.python.org/mailman/listinfo/python-list