Under The Influence
This is a modal window.
The media could not be loaded, either because the server or network failed or because the format is not supported.
Formal Metadata
Title |
| |
Title of Series | ||
Number of Parts | 50 | |
Author | ||
License | CC Attribution - ShareAlike 3.0 Unported: You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal and non-commercial purpose as long as the work is attributed to the author in the manner specified by the author or licensor and the work or content is shared also in adapted form only under the conditions of this | |
Identifiers | 10.5446/37501 (DOI) | |
Publisher | ||
Release Date | ||
Language | ||
Producer | ||
Production Place | Miami Beach, Florida |
Content Metadata
Subject Area | ||
Genre | ||
Abstract |
|
Ruby Conference 201344 / 50
2
3
7
13
15
17
18
19
28
29
35
39
44
48
49
50
00:00
XML
00:31
Formal languageQuicksortPlanningBit2 (number)Level (video gaming)
00:51
Level (video gaming)Quicksort
01:20
Expert systemFormal language
01:56
TwitterMultiplication sign
02:26
Multiplication signFormal language
02:48
Formal languagePoint (geometry)MereologyDirection (geometry)2 (number)Code
03:29
Formal languageImplementationOnline helpUniverse (mathematics)MIDIPatch (Unix)CompilerMixed realityComputer animation
04:40
Formal languageSlosh dynamicsPlanningMereology
05:07
Equivalence relationFigurate numberFormal languageCodePlanningVariable (mathematics)Computer-assisted translationRight angleElectronic mailing listDeclarative programming
05:39
Type theoryVariable (mathematics)Symbol tableElectronic mailing listFormal language
06:13
Variable (mathematics)Sign (mathematics)Revision controlString (computer science)Computer fileLibrary (computing)Ring (mathematics)Variable (mathematics)
06:41
Mixed realityString (computer science)Social classBitObject (grammar)
07:10
Installable File SystemType theoryIntegerOffice suiteTrail
07:32
Type theoryTable (information)NumberAssociative propertyDifferent (Kate Ryan album)Symbol tableString (computer science)Right angleHash functionVector spaceElement (mathematics)Key (cryptography)Equivalence relationElectronic mailing listSequenceArray data structureWordDivisor
08:23
TorusComa BerenicesHash functionSign (mathematics)String (computer science)Symbol table
08:46
Revision controlRight angleCodeGraph coloringMereologyIntegrated development environmentLevel (video gaming)Interpreter (computing)
09:22
Cohen's kappaLattice (order)MIDIMereologyComputer-assisted translationWater vaporEquivalence relation
09:54
MereologyParameter (computer programming)Type theorySimilarity (geometry)Figurate numberSinc functionLetterpress printingObject (grammar)String (computer science)Office suiteFunctional (mathematics)
10:40
Execution unitPointer (computer programming)Category of being
11:45
Cube (algebra)Network topologyParameter (computer programming)Object (grammar)Slosh dynamics
12:09
Point (geometry)Computer-generated imageryRight angleInstance (computer science)MereologyDifferent (Kate Ryan album)Graph coloringInterpolationComputer fileInterpreter (computing)SineString (computer science)
13:05
MathematicsNumberBit rateExpressionSocial classMedical imagingRight angle
13:34
File formatImplementationMoving averageWater vaporCondition numberPoint (geometry)
14:22
Regulärer Ausdruck <Textverarbeitung>Letterpress printingMathematicsMereologyLine (geometry)SineModule (mathematics)CodeObject (grammar)Right angleFormal languageComputer animation
15:01
FlagComputer-assisted translationObject (grammar)Bookmark (World Wide Web)Closed setRatsche <Physik>Multiplication signComputer animation
15:56
Menu (computing)Message passingSign (mathematics)Parameter (computer programming)Line (geometry)String (computer science)Heegaard splittingContext awarenessDefault (computer science)Revision controlSymbol table
17:35
Menu (computing)Default (computer science)Parameter (computer programming)Computer programmingMereologyRight angleSocial classLipschitz-StetigkeitObject (grammar)Computer animation
17:58
Multitier architectureSocial classRight anglePattern languageMultiplication signComputer-assisted translationSocial classInheritance (object-oriented programming)Graph coloringRevision controlObject (grammar)
18:28
Instance (computer science)Social classRevision controlObject (grammar)System callMoment (mathematics)Computer animation
19:20
Social classOnline helpString (computer science)Cheat <Computerspiel>Computer-assisted translationView (database)Computer programmingVariable (mathematics)Meta elementSocial classObject (grammar)
20:13
Social classVideoconferencingVariable (mathematics)CodeObject (grammar)Graph coloringMereologySocial classPoint (geometry)Revision controlOrder (biology)Instance (computer science)Computer animation
21:14
Right angleComputer animation
21:47
Multiplication signComputer-assisted translation
22:07
Inheritance (object-oriented programming)Social class
22:43
Inheritance (object-oriented programming)StatisticsSocial classLinker (computing)Computer-assisted translationProcess (computing)Inheritance (object-oriented programming)Social classOrder (biology)WhiteboardCASE <Informatik>GodSystem callBit rateObject (grammar)Revision controlQuicksortRight angleComputer animation
24:42
Inheritance (object-oriented programming)Revision controlMultiplication signCodeDefault (computer science)FreewareFormal languageInstance (computer science)Computer-assisted translationFlash memorySystem callRight angle
26:02
Execution unitSoftwareVideoconferencingComputer animation
Transcript: English(auto-generated)
00:17
So, I'm Zach. Nice to meet you all. Title of
00:28
the talk's One of the Influence. I'm gonna talk about a few Ruby languages, and I'll, I'll tell you what they are in a second. And
00:42
how they're related to Ruby. And a little bit about them. We're gonna, we're gonna look at some code. That's my plan. My hopes for you at the end of this talk are you'll get some sort of level familiarity with these languages, and that's always good.
01:04
I hope you feel inspired to try out these things and experiment with new stuff. Try something new that you've never tried before. Try something old. But encourage you to do something.
01:24
A lot of these talks, even at this conference and a lot of conferences in general, are based on, like, getting something done, or how, like, how to do something better, how to get better at something. Or, you know, we're very focused on like performance and speed and efficiency. And
01:47
I don't really want to talk about that stuff. I want to talk about something fun and something I, I thought was interesting and, and I hope you find interesting. So, I'm also not an expert. I'm standing up here, but I have no, like,
02:01
I just learned these languages in like two weeks to prepare this talk. So, if you have any questions at the end, please just hold them and then you can ask me on Twitter or, you know, just come up to me, say hi and, you know, we can talk about
02:20
these things. I'm really interested in them too. You probably know way more than I do, but for some reason I'm here. And I chose, I, I chose to do this because a lot of, a lot of times people give like the same talk over and over again. And I really want to just do something new that I've never done before. Challenge myself. Make something
02:41
that represents something that I'm really interested in but I've never tried. And the languages I'll, I'll announce in a second. I chose them because they either inspired parts of Ruby language, the design of Ruby, or were inspired
03:02
by Ruby directly. So you have old and new. I thought it was really interesting when I was looking up some of the documentation for one of these languages. They said, consider very carefully before using this code for anything mission critical. That's
03:26
kind of the point. So on the, the first language is Dylan. And it was designed by Apple in like the mid-90s. And CMU is Carnegie Mellon University. They produce like
03:43
a Unix implementation of the language, which I used in learning this. I just downloaded like the compiler and just like used it on my Mac. It's pretty easy to get started. There's a lot of great documentation. I submitted a few patches in learning the, in learning the language to like help fix the documentation, so I always find it's really good
04:03
to like mix some open source in with learning something. It's always good to do that. Like, give back what you gain. The other one is Perl. Probably not something most people don't know, but I see a lot of new faces here and a lot of new Rubyists and people new to the community, so
04:22
I think Perl might be a little shocking to some people how similar it is. So I chose that. I'm also using like some weird features of Perl that really only exist like recently, so it doesn't really apply that great, but it's there. So I used it. Another one is Slash. Slash was developed recently in
04:44
the last few years by a Ruby commander named Charlie Summerville, and he is like less than twenty years old and created his own language. I thought that was really great. Really, really inspiring. So I wanted to talk about it. I wanted to
05:00
learn it. I wanted to figure it out. And, so I chose that one. So the first part, basically the plan is look at some Ruby code and then look at like the equivalent Ruby code in these other languages and hopefully figure it out.
05:24
So this is some Ruby code, right. We start out very simply with variables, right. So my cat is Ginger. That's his name. You should know this by now. And the Dylan equivalent looks something
05:43
like this. So you define a variable and they use like list style variable declarations, or any symbol really is, as dashes instead of underscores. I think you can use underscores. Didn't really work, but. So that's Dylan. You have types. Dylan has
06:03
types. You can define your own types. They're not really statically typed. It's more like a dynamic language, hence Dylan. And then you have the pro version. So my creates a local variable and the
06:22
dollar sign indicates that it's a scholar. And we're gonna sign a string to it. That just basically means it's a, it's a reference to that, to that thing. So we can, we can use it within the scope of our, our file or library or whatever.
06:42
And then here's slash. Slash is like bits of PHP mixed in with Ruby and Perl. So you have like this open thing. But you don't close it. Like, what is that? And then this is
07:03
very similar to Ruby. So there's a, there's a native string class that you can initialize a new object. Moron types. So this is some Ruby. You have integers and you have an array. In about April,
07:22
Ginger will be three years old. So his favorite spot is in my office, upside down on the paper tray. That's just where he likes to hang out. I don't know. The Dylan equivalent is this. So you have a number as an integer. You have different types of
07:40
numbers like Ruby, where you'd have like a big num, something like that. But I just stick to numbers because they're really easy. And a hash is basically a table. So it's just a hash table. So they just call it a table. And vector is a type of array. They have different sequences, so you can have, like, different
08:01
types of arrays, associative arrays, things like that. And vector is like the basic, it's almost like a list, right. In Lisp. So you just have, like, elements in this thing. And this is basically their symbol. So you don't have string keys. You have symbol keys. And that's how you define a symbol.
08:23
Perl looks something like this. Very similar to Ruby. We have a list. And this hash is denoted by the hash rocket things, and these bear words, which you could have string keys, or you could just use, like, those get entered into symbols, I think, somehow.
08:40
Oh, and the percentage sign is like a hash, and the at sign is like an array, basically. This is slash. It's basically identical to the Ruby version, right. They're the same, just different colors.
09:01
That's how, that's how Vim interprets. So I use a really, when I was writing this code, I use a very high-level, like, complicated development environment called colored pencils. They work really well.
09:24
So methods are a big part of Ruby and a big part of organizing your code, right. So, when Ginger turns three, I also love that I forgot the end on this. But Ruby has ends.
09:41
And his mom and dad are Greta and Walter, who my mom bred, bred them, and I got like the last cat. So he's like the golden child, basically. The Perl, the Dylan equivalent, you define methods.
10:02
This, Dylan also has functions. The interesting part is right here, where you have your arguments. You specify the type that they are, and that is basically how Dylan figures out, like, its method dispatch. How it decides what object this method is attached to. So it doesn't actually have singleton methods like
10:23
I defined, but it has something similar. And this is, like, the return. So, since I'm just formatting a string and printing that, then there is no return. It's a void. I'm really thirsty.
10:43
Give me a moment. It's dry in Miami. It's
11:00
juice. Strong juice. What were we talking about? Perl. This is Perl, right? Yeah. So, calling a method, like join, you can actually,
11:28
in some cases, like Ruby, you can, you can omit the parenthesis, which is cool. Sometimes you can't. I haven't quite figured out when and where, why.
11:40
When I do, I'll let you know. Maybe you know. You can tell me after. Oh, yeah. There's this, there's this thing, which Matt's also brought into Ruby, which I have no idea what it means. It's there. You use it. I don't know. Look at the documentation. It's there, and it's basically like what, what you passed in. You don't
12:02
have arguments. You just like, use this thing, or you shift off the arguments. It's magic. Slash is cool. It's very similar to Ruby, right. You can't omit parenthesis. You have to use them. And you can call methods
12:20
on an object, because everything is basically an object. There's some instances where they're not, but I haven't quite figured that out. The other really cool part about this is, that's a comment, and so is that. But my syntax
12:41
highlighter didn't understand it. It wasn't good enough. It's too new, so I had to, I had to, I had to use different colors. Same with, same thing with the interpolation. So, years old is a variable that I interpolate into that string, and it's the same color. Usually we're used to seeing different colors, but I'm not that
13:03
good yet. Expressions. So in Ruby you have this, this is probably the coolest thing about Ruby, is you can have post fix expressions, right. You can call even
13:21
or odd, come with the native number, number classes. And you can do things like math. I'm pretty sure that's right, although I probably got it wrong. I wouldn't be surprised. That's Dylan. No post fix conditionals. They don't have
13:42
that. So you have to do something like if and then end if. I talked to Matz about this yesterday and he said, originally Ruby had end if, but it didn't work when he tried to implement post fix conditionals. So he got rid of it. That's a little history lesson. That's why
14:02
I'm here. The pro version, also, no post fix. And, and, and no odd or even. You have to do this thing. This is like modulus. And that's probably right. I assume so. At least it worked when I tried it.
14:22
Same thing. My syntax highlighter thought modulus was a comment. So the rest of that line, you get the idea. So the next part. OK. That was
14:43
the basics. Hopefully you got a good idea of what it's like to write those languages and what they're all about. I could probably have explained it better. But there's always next time, right. Next RubyConf.
15:01
Objects. Let's talk about objects. That's a lot of fun. Where do I start? My cat is Ginger.
15:21
My cat's favorite toy is a white mouse. He loves that thing. It has, like, it rattles and he plays hockey with it. Sometimes he plays with different toys, so I can change that on him. I can give him a tin foil ball. He loves that too. It's free. Well, close to free. And he also has some really good friends in
15:41
the community. Gorby's one. Loves Gorby. C. Taxe's favorite, because she's just, she's just loud. Lobby and Sobby, if you don't know them, they're like cows, but cats at the same time. It's amazing. Again, with the cats. It's very original.
16:02
This is the Dylan version. So when I define a variable and I want a, I want a method that has like a default keyword argument, you can see on like the third or fourth line it says key toy and then the
16:22
string, and that, assign that to the white mouse. So you have keyword arguments and you, and you also have rest, which is like, splat or, no, not even splat. It's like, something in Ruby that I can't think of right now. But you
16:44
can just pass, and then you can just pass in whatever arguments and whatever you throw at it, it, it, you know, it just joins them all. So that's pretty cool. The Perl version. When you're using the at sign
17:02
and like the magic underscore key thing, you know, it just says, you know, this is an array. Based on what, what context you're using it in, and what, what symbol you use. So if I was to use a dollar sign, that wouldn't work, because it, it'll see the, the array and
17:23
Perl will think like, oh, I need to turn that into a string because he's using the dollar sign. So if you use that, you, you know that it's gonna be an array. The slash version, very similar to Ruby. This
17:44
is probably the neat part, where, instead of like rest, you have ellipses. And you can just assign default, defaults in the parameters like you would in Ruby. The next thing is classes. Once you have methods,
18:03
you might want to abstract that into a common thing, right. That's why we have object-oriented programming. It's a very common pattern that we use often. So I can define a cat, and I can give that cat a name and a color,
18:21
right. We've seen this a hundred times in all of our text books. We've never seen this cool, right. The Dylan version, you define a class and it inherits object. So everything in Dylan is basically inherits from that. That's like basic object in Ruby. It has no real methods. It's just like
18:42
a, a way to allocate a class. When you want to create a new instance of an object, you use make. You can also call, I think you can call new
19:04
directly, but make specifies that you want this thing to be of that type and call the initializer. We'll get to the initializers in a moment, but. The bare bones version is that in Dylan.
19:22
I use Moose and Perl. I think that's cheating. If any of you know Perl, there's actual ways to do object-oriented programming in it. They were kind of tacked on in like the mid-nineties. Someone, someone had a bright idea and they added it. But I don't, I couldn't really figure
19:40
out how to use it, so I use Moose. And that gives you like some really helpful things like has and some other stuff. You can get the meta class and then you can, you can print out the name of it. I'm guessing, from what I've seen, that all objects in Perl have a name thing
20:01
that you can call and it gives you like a string of that thing. Like a method or a variable. It'll just give you the back, what it, what you called it. I might be wrong on that, but. From what I've seen. The slash version is really interesting. They don't have accessor methods. You have to define your getters
20:20
and setters on your own. So we have, you know, we have a color getter and we have a color setter. You do have instance variables, but there aren't accessors to them. And I can define 2s, and I can just print that object, and it calls 2s on it in slash. I had to go through them.
20:42
I'll do it in Perl slash. What one am I on? OK. So you can do that and you can, you can just call class on it and that gives you the name of the superclass. Before the next part, this is, this is critical. Now that you know all this code, in
21:02
order to understand the next part, you're gonna have to watch this video. And if you don't watch it, you might miss out on the point. So that's Gorby. And he's just being Gorby, right.
21:28
He really likes this thing. Wait, it gets better.
21:58
I love Gorby. I do. I just
22:02
love cats in general, but I want to watch that again. So we have Gorby as a class. When
22:34
you print Gorby, he just wants to know one thing. Where the fuck did you put that clock?
22:50
You notice I called super? And that called up to the 2S method on the cat class, right. In Dylan, these things keep tripping me up. Oh
23:03
my god. You have next method, and what happens is, in the method dispatch of Dylan, it finds these methods that could apply to a given object. So it tells you the generic methods that you
23:24
could call on it, and it picks, like, the most specific one to that object, right. And it orders them. It says, all right, this is the closest one. We're gonna call that one. But you also have this one, this one, this one, in order. And next method will call the next specific method in that array.
23:41
OK. And so, in this case, since we define puts on the cat class, when we redefine it, or we define it again on Gorby, because Gorby is also a cat, that's the next specific method. So you
24:03
can call that next method. And you can even go up further. In cat, you could call next method, and that would call the next one and the next one. So it's sort of like super, but not quite.
24:20
In using this, I think you get super from moose. It might be in Perl itself, but you can have super. And, and you can override your method and just extend the cat class and implement your own, implement your own cats at your disposal. I do this every day in my job.
24:41
Always, always cats. And this is what the slash version would look like. So you have an initializer using init, and that would be how you, when you call new, that's basically what's called, is init. So, same
25:01
as initializer in Ruby. And you can set the default instance methods. I don't have to redefine the getters of the setters. I just get them from cat, right. When I extend cat, I get all that stuff for free. And then, because slash has no super, that I know of, I just allocate a new cat and
25:22
then call 2s on it, which is basically like the default, right. It'd be really nice if slash had super, but I don't think it does. I think Charlie's here, so maybe, maybe go find him and ask him. It's a really interesting language, and it's very similar to Ruby.
25:41
And I really like it. So let me get to that. That's, that's all the code I have to show you. And I'm not taking Q and A. Sorry. But feel free to tweet at
26:06
me or find me after and ask questions. I don't want to take up any more time. I hope you really enjoyed this talk. And thanks so much for coming here and, and sharing this experience with me, and I hope you like my talk. That's it. I'll see you in the next one.