yeah
- the well-grounded newbie advice for Ruby newcomers and their mentors
I know that not all of you are Ruby newcomers in fact I see some reasonably
seasoned Ruby programmers in the room but as you'll see this is advice partly
for newbies and partly for people who might have occasion and turn to advise
or mentor newcomers to Ruby just a couple of words about me
i started using ruby in two thousand which was when the pickaxe book came out
the book programming Ruby by dave thomas and Andy hunt
I sort of stumbled on the book literally well you know manually anyway at a
bookstore right after it came out and I've been hooked on Ruby ever since i'm
one of the directors and founders of Ruby central and we are the parent
organization of this event as well as railsconf and other projects
what are we going to do today well we're going to learn some what i consider
major common points of confusion essentially what I've done here is to
choose and this is a purely subjective choice but i have chosen points that I
think because I've seen it happen over and over again I think are particularly
either difficult or more tricky or in some way kind of the hard too hard to
grasp for particularly for newcomers
we're going to look at some of these points and hopefully this will improve
both your ability to understand code
and to write code because you'll see exactly what's going on in some of these
cases
we're going to look at seven points again this is purely subjective choice
seven points that I think are common stumbling blocks and i should add it's
not just for absolute newcomers to Ruby this is my choice of of the seven points
is based on years of training
rubyists including people who are not necessarily complete beginners but these
are things that I've seen people kind of have trouble with again and again and
we'll look at how these particular seven points can help you understand Ruby
questions throughout if you have questions just go ahead and and raise
your hand and we may have some time at the end to but if you you know as we go
along if you have questions that's fine i'll try to accommodate them
alright so we're going on this this little trek through seven points
custom chosen by me to help you get a handle on some of the tricky things in
Ruby
ok every expression evaluates to an object
you'll sometimes hear people say of Ruby
everything is an object everything is not an object for example an if
statement is not an object an argument list is not itself an object it's a
syntactic construct keywords are not objects
so there are things in Ruby sort of peppered throughout the code that are
not themselves objects you can point to something and say that that isn't an
object it's a keyword or whatever but everything does evaluate to an object
including things like if statements method definitions class definitions are
so everything evaluates or reduces to an object and we're pretty used to this
with you know what if you just type in like the number ten it evaluates to the
number 10
but here's a couple of the loved ones that you might come across and not not
know exactly what to expect
for example an ifs to have failed if statement always returns nil
so if you say if something
that's not true and there's no branch of the if that returns true or that that
that evaluates to true
the entire if statement those three lines evaluate to nil
so everything reduces to an object and if statement reduces to an object in
this case it reduces to the object mill and it does it never reaches that middle
line that with that string not reach so this is a failed if statement on the put
s or puts method also evaluates to nil and sometimes again especially if you're
not used to IRB which has this read eval print loop going
I RB is very literal if I say put s hello
it will obediently print the word hello
but the entire operation the actual call to the method put s returns nil and put
us always returns nil it that's it
it does not return the string that it prints it prints the string as a kind of
side effect and it returns no that's why you get in
IRB you get the the string printed out but then you get nil as the return value
the evaluation of of the entire statement empty class definitions now
you get this is a little bit arcane there's not too many use cases where you
care what a class definition evaluates to you care about defining a class
you don't necessarily care what the class definition ends up producing too
but it's there
there are a couple of use cases and it's I think just instructive to know that a
class definition does have a value an empty class definition evaluates to nil
so if i say classy
and that's an empty class definition it's nil
if you happen to have an object other than ill in your as the last value in
your class definition the entire definition will evaluate to that object
so the value of those three lines at the bottom classy some value in class
definition and the value of that statement is the string some value in a
class definition
so again everything reduces to an object and went when in doubt if you sort of
wondering why something is nil or why something is until for that matter
think about the the literal kind of looking at what the statement or
expression reduces to all right . number two
it's all about sending messages to objects
this is not an obscure . this is kind of the the lifeblood of Ruby but it's worth
noting that and i think this is one of the kind of really interesting and cool
characteristics of Ruby that it's all about sending messages to objects even
when it doesn't look like it is so for example you have
well you have on messages that come after dots
those are kind of the you know the sort of bread and butter ABC . up case that's
sort of the the the most kind of canonical way to send a message to an
object you put a dot after it and then you put a message in this case the
message up case however in fix and you know
unary operators are usually also sending messages on and I'll show some examples
2 square brackets are a message case statements also end up sending messages
to object so let's look at a couple of these for example 3 plus 2 in Ruby that
in fix plus sign is actually a method call
it's actually three it essentially it's three . + with the with the
the argument - so you're sending the message plus sign to the object three
with the argument to Ruby very nicely allows you to write it as an infix
operator
but you're literally calling a method whose name is a plus sign the same thing
for most of the other arithmetic operators including star and division
and so forth square brackets or another one if you look at a sub - I use the
word sub four square brackets i think it's very old school and not sure but
that what i mean by sub is a square brackets to the object a in this case
has a method
whose name is a pair of square brackets and I'm calling that method with the
argument -
so again i'm sending a message to an object even though Ruby because of its
just what it allows my way of syntactic sugar
so to speak Ruby of has it it looks like syntax but it's actually calling a
method in this case the square bracket method
interestingly even the unary plus the plus sign in front of an object can
actually be defined through this method called + @ sign now this is a kind of
bogus example because you can't actually call it with a . so this is more just to
give you kind of an x-ray of the fact that the behavior of an object in the
face of a unary plug a proceeding plus sign will actually be determined by that
method for example let's see if I can we get this is an IRB session in a
slightly malformed terminal well if I think you'll be able to see this
if I say something like calm class person when I feel like the indentation
is weird here let's let's try this again
ok class person
atra reader name this is just a very simple will say initialize name equals
name and now i'm going to define plus at whoops
+ @ sign and i'm just going to define it as name . up case and you'll see this
just allows us to kind of follow the the the dye through the bloodstream so to
speak
so now i'm going to go David equals person . knew this is just going to run
off the screen
home is that how clever of me just invented the mouse ok David equals
person . new
and we'll give me a name
now this is you know this is just sort of whimsical example but if I now say
plus david i get my name in uppercase right in others I i have defined the
logic for the unary plus sign and it it behind the scenes involves sending a
message calling a method and coming up with the result of that
alright so operators are mostly methods and that this is actually just an
example of of the regular plus sign in this case I hope it's not too small but
I mean you can you know sort of experiment with this - on your own
this is another person class it has an inner class called couple
the idea here is that when you have a couple of people which you achieved
through a plus sign
you get if you look at where it says def to s basically the string representation
of a couple is the two names joined by the word and so if i say John equals
person knew
Marcia equals person new give them the appropriate names a nice a couple equals
John plus Marcia what happens is the the plus method gets called and it returns a
new couple and then if i print the couple it it falls back on the 2's
method for couples and it Prince John and Marcia
so basically you can again this is sort of whimsical example as most of them are
as you'll see but you can you can basically do what you want with the the
plus logic but again it's always calling a method and and by the same token you
can sort of look into it by defining that meant yes
right
that's just the name of the Met that's the the name of the sort of the hook
you have to define so yeah yeah i mean if you define just plus then you get the
the in fix operator syntax if you define the plus at it gives you the unary plus
behavior
ok
another i think really prime example of a case where where Ruby looks like it
isn't sending messages to objects but it actually is is the case statement now if
you look on the column on the left and just ignore the rest of the moment I
have case some string which is whatever when ABC which means if this if the
string is the string ABC do so you know such and such to other that when regular
expression d e f if the string matches the EF do something else and case
statements in Ruby are governed or engineered by this method whose name is
three equal signs now or the the threequel operator if you will
um what actually happens under the hood
when I say when ABC I have a when Klaus
what's actually happening in terms of of what Ruby is doing is it's saying if a b
c 3 equal signs some string right if I say case some string when ABC
I'm really saying if ABC three cool
some string and that in turn is really just syntactic sugar for this
there is a method called three equal signs and it like the plus sign if you
use it as an infix operator
you're actually calling a
method now this middle one where use it as an infix operator that sort of a you
know kind of hypothetical you know you don't actually necessarily see that I
mean when you do the case statement this is all you know wrapped in layers of
syntactic sugar on top of sugar but what's really going on is that I'm
calling the threequel Matt the three equals I method on the string ABC with
the argument of my my case expression some string
now what this means again is that you can also roll your own
in other words if you want to define your own case behavior
how am I objects going to fare in the pace of a case statement
well here what I've done is again that the good old class person i I've now got
name and social security number
so with SSN and up there in red I've defined my frequent method and what it
basically says is the threequel method returns true if my social security
number is the same as the social security number of the argument to the
threequel method
so what happens then i create David with a number joe with a number and mystery
person with as it happens david's number
so now we're going to see which which person is the mystery person well when
Joe but as it's joe when David because it's david and again this is based on
Joe three cool mystery and David three cool history and of course it turns out
to be
David so you can actually govern the behavior of your objects in case
statements by hooking into this three cool math that you never actually other
than defining it you never work a statement at least you never actually
have to type it it happens just happens automatically
but that's kind of the underpinning of some of the the case behavior
alright so we see messages are being sent to objects even wear it doesn't
necessarily look like they are as in case statements and infects operators
it is also true and this is our third .
that objects resolve messages into methods now I am splitting hairs here i
am i am kind of putting in a wedge between the message and the method in
normal conversation right we talked about we send messages to objects or we
say you know I i called the up case method on this object or i sent the
message up case to this are probably more often say I called the up case
method on this object method and message
are you know that there's a little bit of fluidity just in kind of how we use
the most of the time but I'm again i'm driving a wedge through that I want to
be be clear about the difference between sending the message and calling the
method
my take on this and I've actually gotten in trouble on a mailing list for saying
it this way but I thought about it and I've decided I'm sticking to it on that
objects do not have methods now it is sort of a half-truth I mean you can say
yes the string has an up case method but what i mean by this wednesday objects do
not have methods
what I mean is that the method itself does not live in the string object
the method itself let every method lives in a class or a module there are no
exceptions to that every methods are defined in classes or modules
they're not defined even a method that you define on an individual basis just
for one object that method and you can do that in Ruby defining singleton
methods that method still lives in a class
it lives in what we call the singleton class of the object
so every method even if it's just a method on one object every method lives
in a class or module so object that's what I mean when I say objects do not
have methods objects have intelligence you send a message
- an object the object has the intelligence to to search through app at
a predetermined path of classes and modules to find a a method that
corresponds to the meth best sausage
so I sent the message up case to a string the string has a search path
where it looks for a method
whose name is up case and when it finds it executes if it doesn't find it you
get a method method missing ever
this is a diagram actually from my book the well-grounded rubyists and what's
going on here is if you look at the bottom we create a new object and send a
message X now this just gives you a sense of of where an object looks for
methods we in this case we're looking for a method called X going to actually
not find it according to this because it's not actually defined the first
place it looks is actually in what I referred to as the singleton class of
the object which is really just a storehouse for methods that belong only
to this object and in fact singleton classes are only created sort of on
demand objects just for efficiency reasons objects don't even have a single
to method unless you are sorry singleton class unless you define a singleton
method or or open the class explicitly as I've done here
now the singleton class this this notation class
arrow arrow object that actually opens up the singleton class of of the object
and what i've done here is i've included a module called and what that means is
in its as the object searches for this X method after it looks in it singleton
class it will look in any modules that are included in that class so it goes
off and makes us what I think of its kind of side trip to the module and
does not find a method called X comes back to the main track and goes up and
now it's at the class d which is the class of this object so it's now looking
in its in its original class and saying you know is there an X method
well no there isn't ok how about any modules that are included in this class
well there's a module called am that's included in this class so let's go
looking at them
is there an X method No so back we go and up to the superclass of d
notice the d inherits from sea we look and see
we find that there's no x.x method and it actually would go beyond that
once you hit sort of the top of your class tree it would then go up to the
object class on the the kernel module which is included an object and then
finally up to the basic object class which is really the top of the tree and
if it doesn't find it the carrots
it's it's failed and you get a method missing error
this is just a little bit of sort of showing the the lookup in action again
that the person class with the name accessory i create a person object named
david i'm now going to create a module called vocal which simply has a method
called talk and it's it's a little bit tightly coupled with the person class
admittedly it it depends on the name method but will will let me
will will give me a free ride on that one house that so we have a method
called talk which basically just says your name
now I class person i include the vocal module that means if I say put s David .
talk
David the object David this person object now has access to a talk method
and notice one important thing here is that when i created David David did at
that time did not have a talk method because there's no talk method in the
person class but even after i've created the person object I can include a module
in the person class
and even the pre existing objects will be able to find the methods that are in
that module
it's all about what the object nose at the moment that you send a message so i
sent the message talk and at that moment all it cares about is is there such a
method in my classes are such a method and a module included in my class I
guess there is because it includes vocal
so that's a good a good illustration of the fact that are all objects care about
is what is the state of the things at the time that you send them the message
all right now I have a second module called loud and what this does is it
actually called super which suit what super does is super walks up this path
of of method searching and finds a previous definition and execute that so
it's going to walk up the up the class and module path looking for a method
called talk and it's going to find it well I'm sorry i should mention i can do
class person include loud
so now when I say put s David talk it says hi my name is David but in capital
letters with ! because now it's loud now one thing here this is a little bit of a
contrived example well most of them are in this in this talk but one thing that
this illustrates is the order of execution when you include more than one
module the object when I say put as David talk
it actually finds the talk in the loud module and look the loud module finds
the talk in the vocal module
basically when you when the object is doing this search through classes of
modules when it's looking at modules it goes in reverse order of inclusion
so the most recently included module will be the first in the search path and
then the next you know that if you call if it doesn't find
there goes to the next one and so forth or in this case super takes it to the
next one
so it's a very sort of you know strict set of rules governing the to look up
the method look up process and then this one is just a illustration of extend in
this case what i've done is i've said module quiet defined talk and this is
you know multiple parentheses just to show you how quiet it is and what I do
here is I i take the David object and I extend it with quiet and when you extend
your it's similar to including a module except it's on a per object basis
so what I'm saying is you know most personal objects are going to talk loud
at this point but this one person object i'm extending with the quiet module so
now when I say David . talk
I get the result of of the quiet on the quiet version of talking
so basically you can you can manipulate you know what where the object is going
to find a method on where along the path that's going to either find it or fail
to find it on and it's good to to know again that objects are looking along a
path of modules and classes the object is not itself sort of possess the method
all right classes and modules are objects
the answer is seventy-five percent of all questions about ruby is because
classes are objects me and its really remarkably true
huh there's a lot of a lot of things that get clarified when you when you
totally grasp this idea that classes are objects because classes and modules are
objects and classes sort of our modules actually quite the class class is a
subclass of the module class so classes and modules are very very similar
objects and not in every way but in a lot of ways but class of the modules are
objects therefore you can send them messages right just like you can with
any other object you can put them in collections
you can assign them to local variables perhaps one that that causes some
confusion is the fact that a class can actually have its own instance variables
every object in Ruby hat has at least potentially a stash of instance
variables that represent the private state of that object
well since the class is an object it can have its own instance variables that can
have its own private state
it's not something you do every day
you don't necessarily you know always have a need to give instance variables
to class objects but it's good to understand that you can because the
class itself is an object and therefore it has you know sort of all of the the
rights and privileges connected with being an object like being able to have
its own its own its own instance variables here is just again a little
code illustration I i have a class person i assign it to a local variable
this is just to you know make it clear that it's the object that matters it's
not the fact that it's a reference in a constant like person you can put in it
you can bind it to any identifier
I say David equals my class . new so even though my class does not begin with
a capital letter it the object it evaluates to is a class and therefore i
can call new on it
the the commented out line is if i take class myclass that doesn't work because
the class keyword does expect a constant so you can't just drop in the local
variable in that position
however you can do something like my class . class event
all and what that will do is it will put you into a class definition block that's
based on that class and then you can proceed to define methods and so on so
there's as usual there's ways to sort of us related alternate techniques for
doing stuff that that at first it might seem you're not allowed to do
alright so classes are objects is is an important one and worth sort of playing
around with . number five
there's always a self now self play several different roles whatever object
itself at a given moment and there's always exactly one
it's the default receiver of messages so if you are if you're in a context where
we're a string is self then if you just say like down case and not string . down
case or even self dark is a sort of bare word like that
Ruby well first we'll try to resolve it as a local variable and if it fails it
will try to resolve it as a method being called on self the self is the default
receiver of messages when you when you don't specify a receiver and you don't
have a . think they like that
self is the owner of all instance variables now this is a really important
one and this one
this leads to a lot of confusion and and it's worth really internalizing this
every time you look at ruby code and you see an instance variable at whatever
that instance variable without exception belongs to whatever self is at the
moment that it's being executed every instance variable belongs to self
so if you for example one of my favorite examples actually if I say let's just
say class see it doesn't much matter
now look what I've done here I've created an instance variable this also
connects up with the point about classes owning their own instance variables so
that instance variable belongs to sell
now what is what exactly is self at this moment
well if we evaluate self we find itself is the Class C so that instance variable
let's go back in here just I don't actually have to do it again but now if
i say def misleading method
now here's what's going to happen i say see . new and i'm going to say see
misleading method
anyone want to walk into my little trap what's it going to print so mean of me I
really should
well let's just say if you glance at it you could you could easily and many
people have assumed that it will print one because look you've got you know
you're you're assigning to an instance variable bar equals well at bar equals
12 lines later you're printing an instance variable
the reason it doesn't print one a prince nil
the reason is that self has changed and that second line where they add bar
equals oneself is the class object two lines later because i'm in a method
definition itself is an instance of this class so it is a different object yes it
is an instance of the class that was self before but they are to the the
class sea and the sea . new object are two unrelated other than the fact that
one is an instance of the other there
they're unrelated they're not the same object they do not share instance
variables
so what's happening is that ruby is being very literal and saying every
instance variable belongs to sell and as far as that's concerned i had never
initialized the one that's on line 19
right thats that defaults to know because i actually didn't did not
initialize that particular variable the value of self changes it will flip to
something different in a class definition where it becomes the class
itself in a method definition and again this is sort of echoes the example i
just showed where itself becomes the object that will call the method on an
instance of valve it becomes the receiver of instance about instance of l
is basically a way to to flip self to be something else if you want
if you want to to change cell for the duration of a code block use instance of
valve and the object on which you call instance of Al become self for that code
block and in class about becomes the class and module so there's this you
know place is kind of fairly you know fairly small number of places but
important to to grasp yourself will actually change or or flip to another
object
this is just kind of tracing self at different points
one thing to note is that
well self in the class definition body comes out as person self in the instance
method comes out as the person instance again notice the difference this is the
class this is an instance the one in the middle self at the top level main when
you're at the top level in other words you're not inside a class definition
you're not inside a method definition you're just floating in sort of Ruby
outer space
Ruby creates this special object called main which really exist its kind of the
backstop object it's like it exists because there has to be a self so it it
sort of bootstraps the object model by creating this this sort of default
object main and that's why when I say you know show me self at the top level
is actually comes out as main if you type main you can't actually refer to it
as may
and that's just the tag or sort of rapper named that Ruby gives it but but
that's that the top level object before the top level self before you enter into
any context context where self is going to be changed
this is just a quick example of instance eval
I string equals i am a string and I just I print itself and then I do string .
instance eval and here I'd say self is now self and put it up case basically
what's happening is again in that second line self is main right because I'm out
in the the top level when you do an instance of value swap in self
I've swapped in the str the string
I've swapped that in itself for those two or three lines so everything that
happens in that instance of a block happens in relation to that the self
that is that I've called instance of a long class about
similarly here i've got i've actually just created an anonymous class Mike my
class equals class . knew if i print itself in a class about that it's going
to be the class that I've called class about on
so self is is important and again there's there's always there's always
one and it does it does change from one object to another
all right . number six variables contain references to objects
what that means is for example here I say string equals high and I say string
2 equals string
now what i've done here is i've copied a reference to a string from one variable
to another and i put it that way to make it clear that i have not copied the
string i still only have one string object and you can tell that because if
i append the word that
error to the second variable through or through the use of the second variable
and then I print out the first variable the there is there right in other words
I've manipulated the original string by using a second variable and that's
because each of those variables contains a red direct reference to that exact
object so there's no copying going on it's it is actually the same object and
that again can be a source of some confusion especially at first when
you're not sure why objects are being are being damaged in mysterious ways
this is just an example using an array essentially i create an array of three
objects
I copy you reference into a ray - I then add an element to array to and it's
showing up when i print array that that fourth element is present so again i'm
i'm using references to manipulate objects but every reference refers to
the same object every copy of the reference
now here's one that's kind of a another slightly cautionary tale
I have a variable called one which is the string 1 and then I have an array
that consists of one to three notice two and three are capitalized and one isn't
if I capitalized one in place using the capitalized bang method then I've
changed the string 1 to capital
oh and it that is also reflected in the array because the array contains that
same object that that object one
here you see the results are kind of similar behavior in the face of a method
call here i have a method called add bang which takes a string and just adds
an exclamation point to it and you can see if i call add bang on a string
are you using a variable using a reference it operates on exactly that
object because then when I printed out it has the ! the method does not copy
the string it does not return a copy it returned it actually operates on the
original object and and the object reflects that change
note however that if you use plus on strings or plus equals you actually get
it you do get a new strings if I say string 2 plus equals there that is not
going to affect the original string because i'm actually reassigning on
I must I'm reassigning to the string to variable a new string that has the word
there at the end
so if you if you want to not or if you want to use copies and so forth and you
can use the plus equals and that will kind of diverge one object away from
another
all right be careful with fries
the thing with fries is that if you freeze an array for example if I have an
array i freeze it I try to push something onto the array I can't do that
but notice that I can
change the first the first element in the array right i can say a race of 0 .
up case bang and here I've actually changed the first element in the array
to its up case version so be careful with fries because this is you know sort
of it's a little bit tangential to this but it's it's sort of related to
references to you just want to be careful that even if an object is if
it's a collection object and it's frozen
the items in the collection are not frozen
that's what you have to be careful with all right finally
just a little bit about true and false true and false in Ruby are objects but
true and false are also states every object has a boolean value either true
or false
those are the states only two objects have the boolean value false those
objects are nil and falls every other object in ruby is true
so 0 is true and empty strings are true and so forth
now that's usually if it is a source of confusion it's usually pretty brief so
you know coming from other languages
a lot of people expect 02 befalls for example but but it isn't
and you can always run a sort of truth test if you in anything where you can
put an if and here there's again a couple of sort of whimsical examples
where I'm actually i'm testing testing the truth of a class definition
um so if class a and put s true well that's going to return nil so that will
not be true if Class A zero and put us through that will output true because
Class A zero and evaluates to 0 which is true
so this is really just illustrate that you can you can and this may be more of
a mental exercise and something you would do with literally with with if
statements but you can always anything you want to know the truth value of you
can plug into an if statement and if it if it passes that then it's then it's
true
in the boolean sense
all right just a little summary of of what we've covered seven points and
again my goal in doing this is to give you
hopefully the benefit of some of my observations over the years of of things
that that people have found confusing things where people had great sort of
aha moments because they you know it's like aa classes are objects or whatever
or you know other self changed because i entered a method definition so hopefully
like I said at the beginning hopefully some of this will you know be helpful to
you personally it may be that if you work with people or our mentoring people
who are learning ruby it will give you a little bit of you know some ideas about
trouble spots to emphasize and make sure that they understand and I i am going to
stop here i have a few little things but but we will will I think end here
because we're just about out of time
are there any questions yes
morning the rounds
value
just do your place and I just prevented that
yeah you can you can do to avoid the reference problem
yeah i mean duping is is certainly one like you
you do have to be careful also though like when remember that duping is not a
deep operation
so if you do but array you actually get a new array but it has the same object
in it so you can you have to be careful that that it's a shallow do operation
sorry what's the right
right
you have any suggestions for other other approaches to avoid during beautiful
objects
Harry knows that
right I've been I think do thing is sort of
that's the thing that comes to mind
let's say there's nothing else but that's what
that's what
bread and butter somehow it ends up not being too huge problem not sure why
exactly but like just people don't write that many methods that can change their
argument I mean I think it's sort of a bad practice anyway to change are
questionable practices change that you know you send an argument to a method to
actually destroy it and not you know kind of silently changes unless you know
some really compelling reason but
so I think people just avoid some of those things that that old
yes are exhausting behaviors that you have died there
they actually find they discovered hers already defined to be tended movie would
be like that and then with the exception that is that the jruby
and all the other Ruby's implies a few little things especially there
I think I mean I had anybody going to be able to prove me all about this i think
i've stuck two things here that are really are in the language like the fact
that everything reduces to an object like a class definition again there's
not that many cases where you where you use that back directly but i believe
that it is sort of inherent in the line think the language that everything in
another class definition we would evaluate to an object if it's time to
evaluate
well now there and I'm not so they've been talking about for example having
method definitions evaluate two symbols that are the name of the method and
things like that
I don't know whether any other implementation is actually done that
I don't think so but it that's something where you could because Ruby makes very
little you can basically any method definition whatever is inside it
the definition block itself value X to the hill so that in a way it's a wasted
opportunity because we could evaluate to a name
you could evaluate to a man that object whatever
so I'm not sure whether any any of the other implementations that sort of
stepped into that particular space and it certainly could happen but I i think
most of you know what i would probably I think would have applied all
yeah
you get what
ok there yet so everybody's you get back
compiling the object ok let from the definition body parts that i didn't
really talk about those
that's an example where something sort of you know in this family of things
might be different
all right thank you very much
No comments:
Post a Comment