Summarized using AI

Toward a Design for Ruby

Brian Ford • November 01, 2012 • Denver, Colorado • Talk

Summary of "Toward a Design for Ruby"

In this talk at RubyConf 2012, Brian Ford discusses the state of the Ruby programming language and the challenges it faces as it evolves. He emphasizes the need for a structured design process to ensure the language remains viable amid growing competition from other programming languages. The key points from his talk are:

  • Ruby's Popularity and Impact: Ruby has seen significant investment and adoption, with many companies relying on it for their operations. Ford appreciates Ruby's beauty and effectiveness but cautions against complacency as rival languages like JavaScript and Java gain prominence.

  • Challenges with the Ruby Design Process: Ford identifies a lack of a formal design structure within the Ruby community as a major obstacle. Currently, decisions about Ruby's development are made in an opaque, ad hoc manner without sufficient stakeholder consultation, technical rigor, or clear rationale.

  • Technical Challenges: He highlights specific technical issues that threaten Ruby's ecosystem, such as the complexities introduced by recent changes like encoding and the implementation of keyword arguments. These complexities can lead to confusion and bugs within applications.

  • Historical Context: Ford reflects on the transition from Ruby 1.8 to 1.9, which involved significant changes that not all users adopted promptly. He expresses concern over the reluctance of developers to upgrade and emphasizes the need for a concerted effort to address this stagnation.

  • The Need for a Design Committee: Ford proposes establishing a Ruby design committee comprised of representatives from diverse implementations and stakeholders. This committee would guide Ruby’s evolution with an emphasis on technical rigor, comprehensive documentation, and effective communication across language implementations.

  • Focus on Concurrency and Security: He calls for improvements in concurrency handling and security practices within Ruby. Effective concurrency support is crucial as computing hardware continues to evolve, and security measures need to be standardized across different Ruby implementations.

  • Closure and Collaboration: Conclusively, Ford stresses the importance of collaboration to prevent Ruby from fragmenting into competing interests. He warns against a potential fork that could jeopardize the community and Ruby's future as a language.

In summary, Brian Ford's insights underline Ruby's beautiful functionality but call for immediate attention to its design process to safeguard its future against external pressures and internal inefficiencies. The proposal for a design committee represents a proactive strategy to enhance Ruby’s development trajectory and community engagement.

Toward a Design for Ruby
Brian Ford • Denver, Colorado • Talk

Date: November 01, 2012
Published: March 19, 2013
Announced: unknown

Ruby is an industrial programming language. In the past eight years, tens of millions of dollars, if not more, have been invested in Ruby itself, and in frameworks and libraries for the language. Many times that have been invested in companies that have been built around Ruby.

The reason for this is that Ruby has been a remarkably good language for a wide domain of programming problems.

However, the world is changing rapidly and Ruby faces a number of significant challenges that have a very real possibility of destroying the rich ecosystem that that has been built around Ruby.

None of these significant challenges are particularly threatening to Ruby. In fact, many of them have been solved by other language ecosystems or are being actively researched.

The fundamental problem is that the Ruby design process is practically nonexistent. What does exist is opaque, ad hoc, immature, and unstructured. Stakeholders are not consulted. Rationales are not consistently explained. Technical expertise is not validated.

In this talk, I will explain key areas where I believe Ruby's existing design process threatens the viability of the language. I will detail a structure for making Ruby design decisions that provides technical rigor and balances the competing interests of existing and future Ruby stakeholders.

RubyConf 2012

00:00:18.039 here uh Ruby com uh feels really awesome this year uh it's a pleasure to be
00:00:26.160 here I really love Ruby it was interesting mat's keynote that he talked
00:00:32.279 uh about the guy who was upset because we aren't all using Pearl or something
00:00:37.399 um in uh 1997 true story um I was playing around on the sunsight edu CD
00:00:43.640 that would came with like slackware or something and there's a whole section on languages which was a fascinating place
00:00:49.800 to be um and uh I looked at Ruby and I started reading the readme and I didn't
00:00:57.239 get blocks at all um but I saw the references to Pearl and I had tried to learn Pearl and it was the most painful
00:01:04.320 experience that I had had uh C was Far easier to learn than Pearl and so I closed Ruby and I didn't come back to it
00:01:10.799 until um about six years later at that time uh the prag Prague book was out and
00:01:16.840 I started reading the book this was after doing tickle and Python and c and C++ and Java and small talk and um it
00:01:23.680 clicked and I have ever since been using Ruby and I think it's a fantastic language so I really really love Ruby
00:01:33.280 also there's a lot of companies that love Ruby so I work for engine yard engine yard uh sponsored reinius and J
00:01:38.880 Ruby for a while and a maintainer for Ruby 186 and has contributed Open Source
00:01:44.399 Grants and a lot of other stuff um Good Company GitHub we all know probably has
00:01:50.040 the cutest um mascot of any project that I know they're a fan of Ruby
00:01:57.520 Heroku uh Travis Living Social Square uh a lot of a lot
00:02:04.759 of companies uh ones that I've left out I didn't leave out for any reason other than I just sort of these are a few so
00:02:12.640 not that many years ago there were not that many people being paid to write Ruby so in this room
00:02:20.080 if you are paid right now to for some or all of your job to write Ruby please stand up
00:02:30.599 anyone who is not standing there are tons of people hiring Ruby developers so if you wanted to
00:02:35.760 write Ruby don't sit down don't sit down if you wanted to write Ruby you should be um talking to one of the people
00:02:41.920 around you who was standing up if you only started writing Ruby for uh pay in
00:02:47.319 the last year please sit down two years three
00:02:53.640 years four years 5 years six years
00:03:01.760 take a look around at how many people are still standing that were being paid to write Ruby either part-time or
00:03:07.319 full-time six years ago six years is a small amount of time you guys can all sit
00:03:15.720 down my point is that it wasn't that long ago that very few of us were being
00:03:22.040 paid to write Ruby I don't want to go back to that day I don't want to see all of us
00:03:27.799 unemployed as rubious so M was talking about motivation in his
00:03:35.720 uh keynote as well and I think motivation is very very important motivation is the reason that I'm the
00:03:42.400 the motivation for why I'm giving this talk has a lot to do with what we just thought about which is where would my
00:03:49.319 salary be coming from right now I'm being paid to write Ruby if it were not for the r programming
00:03:56.239 language when I talk about these issues there's kind of two respon one of them is everything is fine
00:04:03.640 everything's just fine sure there's problems but it's fine or there may be problems but if we
00:04:13.079 just try harder we'll just file more tickets we'll send more patches we'll just go faster no matter how good that
00:04:20.280 car is and how fast it's going maybe faster than that plane maybe it's the angle um it's never going to go in the
00:04:26.800 air unless um maybe it went off a cliff then it would be in the air for a while
00:04:32.919 uh The Landing wouldn't be pretty but um it's basically either everything's fine
00:04:38.000 or we just need to do more of what we're doing and I don't think that's the case so I'm going to try to convince you of
00:04:43.120 of that there are other languages that VI for uh the money that is out there to
00:04:50.960 pay Ruby developers there's Java there's JavaScript no JS there are
00:04:57.600 a lot of people who used to be at these Ruby conferences who are now doing other things with other languages there is
00:05:04.039 closure a fascinating language that's getting a ton of attention but I'm not concerned about
00:05:11.000 any of those other languages I think Ruby has some fantastic features that stand up admirably to any of those other
00:05:18.560 programming languages and to any of the things that people are building in those other programming languages the thing that I see most
00:05:26.600 challenging for Ruby itself and for the the viability of Ruby going forward meaning the um the number of companies
00:05:34.160 who are going to continue to pay people to to write Ruby code the biggest challenge I see there is actually the
00:05:39.919 Ruby programming language itself so
00:05:45.120 that that doesn't sound like a very good thing and it's not and some of the
00:05:50.360 things that I want to explain up here are not um feel good things and I know that
00:05:56.880 we come to conferences we interact with people we enjoy hearing cool things we get excited the emotions of the
00:06:04.800 conference uh rarely have to do with being disappointed or frustrated or uh
00:06:10.800 other negative emotions and we find typically find those things difficult to dialogue about we typically do not have
00:06:17.520 conversations that are emotionally charged that turn out well a lot of times they end up with people just
00:06:23.000 saying well we'll just have to uh agree to disagree in the Ruby Community we have a
00:06:30.440 very very good role model right almost anybody that talks about the Ruby
00:06:35.479 Community talks about Ms and there's that saying matz is nice and so we are
00:06:40.639 nice and I think that's really important I think that's a very very nice thing about ruby a lot of people a lot of
00:06:47.560 people if you look on mailing lists or um places where people gather and talk a lot of people and even from other
00:06:53.800 languages talk about the fact that Ruby the Ruby Community tends to be very inviting that's a great thing
00:07:02.440 but just being polite is not the same as being respectful of somebody you can be
00:07:07.960 polite to your worst enemy so I don't want us to confuse those two and the flip side of that is
00:07:15.120 that if we criticize something it doesn't necessarily mean that we're insulting somebody we work very hard all
00:07:21.639 of us we do a lot of things we we pour our heart and soul into projects and when someone says something about our
00:07:26.879 projects we take that personally it's very very hard hard not to so please repeat after me everyone I
00:07:37.360 am not my code come on come on I am not my code I am not my code because we're
00:07:43.800 going to talk about some things that are critical of Ruby but we are not criticizing
00:07:49.360 Ms we are not criticizing anyone who uh has put their effort into Ruby into MRI
00:07:57.319 or into any implementation of Ruby but we need to talk about some of these things so let's do that so Ruby
00:08:09.080 is this is what most people associate with Ruby Ruby and mat's implementation of Ruby are one and the same
00:08:16.840 thing except that there's reinius this is a project that I work on there's J
00:08:23.440 Ruby that's another project that is implementing Ruby there's maglev there's
00:08:28.639 a talk about mag earlier today J Ruby talk after my talk I believe right yes
00:08:34.560 there's iron Ruby which we haven't heard much about but guess what there are commits going into the iron Ruby GitHub repository iron Ruby is not
00:08:42.159 dead I know someone who is working on a ruby implementation and making very good strides and is not talking about it
00:08:48.800 publicly at all and I think you'll be surprised uh when you find out about it so there is
00:08:54.920 more than one implementation of Ruby because Ruby is actually this
00:09:00.240 Ruby is just a programming language the challenge is is that
00:09:07.200 because Ruby was implemented by matz it's his language his implementation the
00:09:12.480 one that he Tinkers with when he's like what do I want this to do let me
00:09:17.920 see a lot of Ruby semantics actually merely are
00:09:23.519 implementation um details of MRI it's too much to go into all those right now
00:09:29.680 or really talk about that many of them but it's a point to consider a lot of what ruby does is a consequence of
00:09:36.560 Ruby being implemented by MRI MRI a Ruby Ruby
00:09:43.040 implementation is uh primarily C code so all of Ruby core Library array reg Rex
00:09:51.920 hash um fix num big num there's you know all the stuff that you normally use in Ruby primarily exists in code
00:10:00.399 and the Ruby that we use looks uh beautiful the semantics of it at the
00:10:06.839 level that we use it in Ruby are very nice the things that you must do in code
00:10:12.320 to make that look so nice on top are not very nice some of them are very difficult and we'll look at a couple
00:10:18.640 different um places where this this um comes out but basically uh what I want
00:10:25.079 the idea that I want you to think about for a minute is that the implementation of Ruby is primarily in C not Ruby so a
00:10:32.200 lot of the semantics of Ruby that are very different from the semantics of c
00:10:37.279 are painstakingly implemented in C um MRI also uh the canonical
00:10:44.959 repository is still in subversion there was a lot of discussion some time ago about why can't it be in git and now
00:10:52.160 there is a git mirror and you can do pull requests and these sort of things but the fact that it was in subversion
00:10:57.720 was actually something that was a discussion not about an implementation but about the language in a way right it was like
00:11:04.639 Ruby is is is possibly stagnated as a language because we can't send GitHub
00:11:09.800 poll requests sort of thing so the choice of technology that has nothing to do with the Ruby programming language
00:11:15.320 itself does potentially impact it the the bug tracker and email
00:11:21.120 integration sort of stuff is in red mine so you go here to file a ticket and then there are a couple
00:11:26.839 different mailing lists this is a long time like you could go people have been you could read this stuff from from
00:11:32.440 years but it's basically just a mailing list this is a web interface to it but there's one mailing list rubby core
00:11:37.920 where a lot of um features and discussions happen in English and there's another Ruby mailing list called
00:11:44.800 Ruby Dev where a lot of the discussions happen in Japanese if you are interested in
00:11:51.040 learning a language I highly recommend Japanese it's a fascinating language I studied it years ago before I knew
00:11:57.200 anything before Ruby was almost before Ruby was even created and then I stopped that's a sad
00:12:04.240 thing but I'm studying it again the problem is is that most of us do not speak Japanese and it is not an easy
00:12:10.440 language to learn it's certainly not an easy language to learn to read and write so a lot of the discussions happening in
00:12:16.560 Japanese are challenging for those of us who don't speak Japanese so that's a very very very
00:12:24.720 quick like what is Ruby what is MRI I want to talk about some things that I
00:12:29.959 see as being very challenging for Ruby itself and I don't have any good visuals
00:12:35.800 for this but we're going to talk about ghosts of Christmas past present and future Once Upon a Time matz used to
00:12:42.920 release new versions of uh Ruby sort of around Christmas at least a couple years
00:12:48.480 he did so there's uh there's that that what we're going to talk about for Ghost of Christmas Past is the 18 to one n
00:12:57.839 transition this was a very big change in Ruby I think all together it was around
00:13:05.440 seven years of work from the time that uh I think like early on I remember
00:13:10.920 joining the um there was actually an English version of a development list focused on yarv it
00:13:17.760 was still called yarv at that time and uh it did not last very long but it was
00:13:22.839 where I first sort of like this is a project I really want to contribute to let me get on this list that was quite a
00:13:28.720 while ago the things that changed in one n
00:13:33.920 included an entire VM change so the the Ruby interpreter became an actual
00:13:39.639 virtual machine a bik code virtual machine encodings were added there were changes to IO and threads went from
00:13:45.800 Green threads to system threads and a bunch of apis changed uh some of those things ended up back in ruby8 right we
00:13:52.959 were probably pretty familiar with enumerators by now they're pretty pretty cool feature those went actually back
00:13:58.079 into one eight but most of everything else was in one
00:14:03.600 line after so much work and effort went into one nine and one thing I should point out as
00:14:10.759 well is that the one nine semantics took a while to settle down right there was 190 and there was one
00:14:17.839 191 and if you talk to Tony arer who wrote a um rev actor that was using one
00:14:23.399 nine one of the early like in production one N Things so talk to Tony about how some of those things went
00:14:29.759 um finally by 19 192 things that had been changed and then changed back it sort of sort of started settling down
00:14:36.440 but when all this stuff when all this work was done uh MRI had very few tests there was there were very few ways to
00:14:42.880 say this is what ruby looks like now where you're at in 18 and this is what
00:14:48.160 ruby looks like now when you're in 1 n so when people were reluctant to
00:14:53.800 upgrade it started being like well why aren't you guys on one nine now we've put all this work all this effort
00:14:59.680 into making it faster and better you have real threads and stuff like that why won't you update and there's a lot
00:15:05.720 of people there are still thousands of ruby8 rails applications
00:15:12.839 running out there right now we're pushing 20 and there are still people
00:15:18.000 who are reluctant to upgrade to 1 nine this is a challenge for Ruby in
00:15:24.680 general it reflects tremendously when a company is trying to decide what technology to use and someone says hey I
00:15:30.959 hear closure's really good and someone else says hey I hear Ruby's good and some of these things start getting into
00:15:36.079 the discussion this is challenging now we're looking at
00:15:41.279 uh actually you know the 2.0 process and so that kind of brings us to the
00:15:47.639 present um one of the things that we have in Ruby 1 n right now is encoding this is a very very complex
00:15:55.199 topic I cannot do it justice I have been working on implementing en in rubinius for about one year not all the time but
00:16:03.000 a lot of that time um and a lot of what I can actually do in uh rubinius because
00:16:09.639 we we can operate with c and the VM is in C++ is I can actually use a lot of the work that went into extending unig
00:16:16.600 guruma to support transcoding J Ruby actually
00:16:22.240 reimplemented that they have an a port essentially uh as I understand it of onigum so a ton ton of effort has gone
00:16:30.040 into this system it's not a comp it's not a simple system and one of the very interesting
00:16:35.639 things is as an implementation detail every
00:16:40.959 object can have an encoding now think about that for a second what is the encoding of an
00:16:47.639 array what's the encoding of a big num actually big yeah big num I guess
00:16:54.000 you could because it's an object basically these classes these
00:16:59.360 these values of these classes have encodings in Ruby but uh and they make
00:17:04.640 sense right because you're dealing with a string a string can have an encoding a symbol can have encoding Rex can have an encoding because it has a source
00:17:11.679 string but the PG gem for instance um when it reads something from
00:17:18.199 the database at least it did the last version that I tested which was 013 or something like that and actually had to
00:17:24.199 fix a bug in reinius um uses this
00:17:30.200 that object can be anything and this sets a bit in the header if the number
00:17:35.600 of the index of the encoding is small enough and so suddenly some random object comes through the system and it
00:17:42.760 gets tagged with an encoding that was not I was not happy that day when I found that
00:17:50.000 out um and it's it's also a little bit more complex than that because it's a
00:17:55.120 system where some things are legal right I can make that string and say it's as8
00:18:02.400 bit or binary and I can make that string and say it's us aski and then I can put them
00:18:09.320 together or I can make that stren string and say it's as a bit and that string and say it's us ask and I put them
00:18:15.960 together and what the also not very happy when I realized
00:18:22.400 that was a feuture of encodings one of the biggest challenges here is that every single object in Ruby
00:18:30.120 can have an encoding every single string can have a different encoding if you wanted to and if you actually want to
00:18:36.400 see what the implications of that are start looking through code bases like rails and look for Force
00:18:46.320 encoding there's there's a challenge with encodings not every encoding can be
00:18:51.679 converted uh correctly if you uh I guess you'd say losslessly into another
00:18:57.360 encoding and so there's a very difficult technical challenge with an encoding
00:19:04.440 system but making it possible for every single
00:19:09.640 object to have an encoding doesn't solve that problem and having every single object
00:19:17.799 have an encoding means that there are potential latent bugs like that one which I actually spent two days
00:19:24.720 debugging because encodings have to be transferred from one object to the other
00:19:29.840 and this particular bug had to do with the magic Rex pseudo globals if you've ever used
00:19:36.480 the dollar sign uh apostrophe or dollar sign andersan these sort of things um
00:19:43.200 they basically come from Pearl I guess um you can do anything with a match data
00:19:49.840 object but they still exist and the semantics of them because they are scope
00:19:56.440 uh sort of oriented require essentially M support and so while match data was working just fine uh in sprockets there
00:20:04.440 was a Rex match against this JS stuff that was coming through or css stuff
00:20:09.679 that was coming through and dollar sign apostrophe was used to grab the post
00:20:14.880 match uh stuff and send it on its way and suddenly that thing came through was not tagged correctly and everything was
00:20:21.080 blowing up it's the complexity of that system and the implications of that complexity
00:20:27.880 for your application that is um really
00:20:33.640 challenging and it was a system that was mostly uh
00:20:39.679 implemented completely in MRI with no real um participation certainly not by
00:20:46.760 rubinus or J Ruby um which were both sort of going on at the time um and so
00:20:53.120 now as we implement it we discover all these these challenging parts of that system Ruby
00:21:00.559 2.0 um we just saw a couple of discussions about Ruby 2.0 and the things that are coming uh one of the
00:21:07.840 biggest things that I think needs to be addressed in Ruby 2.0 is cleaning up standard lib and it's not really on the
00:21:15.480 road map there's some effort to gemify things but the gems are going to be here and there's still going to be stuff in
00:21:21.600 standard lab as I understand it which can create severe problems Aaron Patterson put out a bounty on a bug
00:21:29.360 where yaml was getting loaded psych was getting loaded from the standard lib and that made it impossible for uh using a
00:21:36.880 newer gem that didn't have a memory leak to actually be working correctly with bundler There's bootstrapping issues
00:21:41.919 there's a whole bunch of stuff there's a whole bunch of complexities that uh are are um
00:21:48.159 implicated by things like standard lib and Ruby 2.0 and we're revving the uh
00:21:54.000 the Ruby Major number to 2.0 and we're going to tell everybody to upgrade again and some of these these major issues are
00:22:00.600 not being addressed they're not even on the um the radar essentially I think so that's that's Ghost of
00:22:07.120 Christmas present Ghost of Christmas future keyword arguments are coming and
00:22:14.960 I think that this is a um wonderful thing there are apis in Ruby that are so
00:22:23.799 challenging to implement um read lines can take
00:22:29.520 a port name and nothing else uh a port name and a limit where
00:22:35.440 did separator go oh it's going to be this by default it's not even in there and optional options or Port name
00:22:41.480 separate or limit options and so um when you're when you're actually implementing Ruby and
00:22:47.360 you're trying to like figure out what the heck you passed me for your first
00:22:53.200 argument it's pretty complicated the code that does this stuff is in many
00:22:59.120 different places because different apis have different things it might be two optional arguments it might be three uh
00:23:05.840 they have different defaults you basically have to put stuff everywhere well we're really familiar with like
00:23:11.520 defining things in Ruby we say Ruby you know def a b is equal to nil C is equal
00:23:16.799 to one you know these sort of things those sort of things that we have in Ruby cannot express these apis we can't
00:23:23.960 express that in reinius we actually have a undefined object because a lot of
00:23:31.080 these apis can take nil as a valid value so you can't just assign nil there you
00:23:36.279 have to say look they really passed me no uh argument at all in this
00:23:42.520 slot so keyword arguments um would make it possible for you to very clearly say
00:23:48.799 my port is this my separator is this and I could just call it with separator this and I'm done right I have that the
00:23:56.360 question is and I don't know the answer to this will these apis be fixed in 20 to all use those
00:24:03.240 keyword arguments if we have keyword arguments will those be fixed so that we can actually sanely Implement these sort
00:24:08.360 of things and the other thing is think about the complexity of that stuff for your code if you're reading through some
00:24:13.600 code and you get to IO readlines which may or may not be the bug you're trying
00:24:18.720 to figure out and it has IO readlines a so some value passed through from who
00:24:24.679 knows where and you don't know whether that's the port name the port name and separator Port name and limit right
00:24:32.480 whether it could be options okay so that's that's that's one of the one of the things will those apis actually be
00:24:38.960 updated in Ruby 2.0
00:24:44.320 refinements so I was hoping and praying that refinements were not going to be in Ruby 2.0 and matz dashed my hopes today
00:24:51.799 at his keynote and someone immediately tweets what I consider to be my biggest concern
00:24:58.679 about refinements I can't wait to use these things in
00:25:07.640 libraries so here's the challenge managing
00:25:12.720 complexity is the challenge we write libraries to help us manage complexity these libraries as you know never have
00:25:20.159 bugs in them right you never have to spend a full day debugging sprockets has
00:25:26.600 anybody spent a full day debugging sprockets raise your hand if you have oh way more people than I thought is that
00:25:33.159 something that you looked forward to the next day did you get up and say I'm oh dang it I don't get to debug sprockets
00:25:39.679 today I finished that yesterday did anybody do that I didn't no way
00:25:46.000 no so the number one thing that refinements adds is complexity I think it's our most
00:25:52.880 important challenge in making software is managing complexity if you went to kuichi talk
00:25:58.559 I'm pretty sure that was on his slide this is about Ruby dispatch Ruby dispatch is implicated in
00:26:07.399 refinements and if one instance of monkey patching is bad how do n possible
00:26:12.600 instances where n is countably infinite countably you might be able to count all those ends uh how can that be
00:26:21.960 okay I I want someone to tell me that active support the sort of things that
00:26:27.559 active support does are often Arguments for refinements I'll give you an alternative
00:26:33.880 argument active support exists because Ruby didn't get fixed we have a rise Shuffle but we
00:26:41.480 don't have a lot of the things that people have found tremendously useful in active support and are using in
00:26:47.600 libraries completely divorced from Ruby because they are very very
00:26:54.760 useful lack of tools is probably the number one one thing that inhibits our
00:27:00.320 ability to understand our Ruby code it's not because someone changed a string
00:27:05.760 method somewhere you know what's so easy to add to Ruby if you want to know where
00:27:10.919 a method is defined you can get the file in line number if you pull up reinius and you do
00:27:16.720 like string. method plus it'll tell you exactly where it's defined if you overwrite it it will tell you exactly
00:27:23.200 where it was overridden it's not hard to understand where these things are overridden
00:27:28.840 right it's not hard to understand what was actually changed on that one single method I challenge anyone to understand
00:27:35.960 where n of those methods might exist and might implicate the bug that you're
00:27:41.480 trying to track down right because again there are never bugs in these libraries that we depend on who has like made a
00:27:47.799 new rails app recently and run bundle and be like that many gems go by and
00:27:53.720 have you looked at the code in those gems it's a lot of code fear is the number one reason to
00:28:00.519 use refinements and it's the number one reason why Library authors will use refinements because they're like I don't
00:28:07.399 want my code to be blamed you broke it but because it broke my code I'm GNA get
00:28:13.200 blamed and so you know what I'll make it so you can't break my code but as soon as you do that you have this one place
00:28:20.039 where this method is overridden and then this other place and then this other place and some of the amazing and
00:28:25.519 beautiful things you can do with Ruby like open a class and redefine a
00:28:31.080 method suddenly can't be done anymore the fact that rubinius can boot the core
00:28:36.799 Library written in Ruby depends vitally on the ability for us to define a very
00:28:42.080 simple method that can get us to the next step in bootstrapping so we can
00:28:47.120 redefine that to the complex behavior that Ruby actually has it's fundamental
00:28:52.440 and that sort of uh bootstrapping scenario can be used in a lot of different places so
00:29:00.320 there's really no code no code at all that needs refinements refinements are
00:29:05.399 not an in an uh extraction of something they're not like we found this to be really useful over here therefore we
00:29:12.840 sort of uh refine that idea into an abstraction and now it becomes a language
00:29:18.840 feature they're an implementation burden um there is no comprehensive
00:29:25.240 documentation and there are exactly zero a giant zero Ruby specs for um for
00:29:33.120 refinements there are some tests and they're going to have unended consequences no one has built a library
00:29:40.080 using refinements yet that's out there in production code that I know of I would love to see it
00:29:46.240 um and instead there are actual problems for Ruby that we should be focusing on very
00:29:53.240 serious problems for Ruby number one problem concurrency every single CPU
00:29:59.640 that's being built today is being built with more and more cores concurrency is vital if we want to be relevant if we
00:30:05.799 want to continue to be writing Ruby codes we have to understand concurrency this guy Tony is at this
00:30:12.399 conference you should go give him a handshake a hug he is working on a project called Celluloid that will do
00:30:18.760 1,000 million times more for Ruby than refinements will do because it's
00:30:24.000 bringing the ability to abstract concurrency and make it more understandable in
00:30:29.440 code concurrency needs a memory model you need to be able to say if I update
00:30:36.399 an instance variable on this object in this thread what do the other threads in this system see as that value there's
00:30:44.200 nothing that's defined it's ad hoc right now J Ruby has a memory model based on top of jvm I think reinius is also
00:30:51.480 trying to define a memory model there are multiple implementations of Ruby your code Can't Behave differently when
00:30:57.240 you update things from two different threads if we don't have a consistent memory model we must deal with this
00:31:03.120 problem an extension API in reinius we go to Great Lengths to make it possible
00:31:08.960 for people to write C extensions and run them that are they're running on MRI and run them on reinus we have a different
00:31:15.200 garbage collector that moves objects the MRI garbage collector does not move objects and people write extensions
00:31:21.120 thinking that objects will always be there or that they can randomly write into the guts of a string because it's
00:31:26.200 just a charray or that they can randomly write into the guts of an array because it's just a c array so we have to do a
00:31:34.000 lot of things to make these things work and there are some things that we cannot do in a thread safe way so we used to
00:31:41.200 put a big Global lock around the SE extension API we took that lock away
00:31:46.519 because basically Evan Dian and I sat down and I said look if things are going
00:31:52.679 to break because they're broken I want to see them break now not later so we took that lock out you can add it if you
00:31:59.200 want it we we took it out so that threads can run in parallel
00:32:04.880 right if your Hardware supports it but there's a lot of things that actually have to be fixed with the
00:32:11.039 Capi uh the jvm has jni it's they've dealt with this problem it's a solved
00:32:17.039 problem there's a way to do it um in order for us to be able to have multiple implementations that can use uh sea
00:32:24.679 libraries like imagine something as complex as encoding that could have been shared across all these different implementations if we had a San
00:32:30.919 extension API um these sorts of things are really important for the viability of
00:32:36.159 Ruby and finally one more security uh rain is giving a talk about security
00:32:41.720 it's not about security of Ruby but it's about security Concepts and it's something that people need to understand
00:32:46.880 we need to really as a community raise the level of awareness about Security in
00:32:52.120 Ruby pardon me we have three kind of things people use freeze to implement some levels of security taint and
00:33:01.320 untrust um I don't even understand how those
00:33:06.679 things work what I do know from working a lot in in in building reinius is that there's a lot of places in MRI code that
00:33:13.559 check things like taint and Trust if you mess up one of those places
00:33:19.760 what happens you have a hole security is a problem the jvm and other languages
00:33:25.320 have have looked at and addressed there may be more more than than their approach to the problem but an actual
00:33:31.760 approach that um that like looks at what we need for security and implementing
00:33:37.399 that in a in a way that's a defined semantic so that every Ruby implementation can uh do it the same is
00:33:44.279 something that we're missing right now those things like freeze and taint and stuff like that are basically hacks
00:33:52.240 for Ruby instead of hacking on Ruby find I want to talk about designing
00:34:01.919 Ruby and the number one thing that I think that Ruby needs is a design committee I know that's a horrible
00:34:08.760 thought we are all a little bit Anarchist I think in our core as rubius because Ruby is a wonderful language the
00:34:16.440 dynamism of Ruby means that we can do things and no one tells us you can't do
00:34:21.679 that until sometimes not ever and sometimes very late in the code right you can redefine methods you can make up
00:34:28.879 classes on the Fly you can add and remove methods you can do all kinds of things in Ruby tons of things in
00:34:34.879 Ruby I love that about Ruby I don't want someone to tell me you can't do that
00:34:40.399 right design committees raise the Spector of a lot of
00:34:46.639 people uh I think arguing unproductively um and uh our freedom is
00:34:55.320 basically at stake I think that's that the perception that I get but I don't think that's the case the reason why I
00:35:01.680 think a design committee is very important is that because we have multiple different stakeholders we have
00:35:08.280 companies some of them very very big companies who are very interested in Ruby and for
00:35:14.920 them it's not so much about whether developers are
00:35:19.960 happy most job descriptions don't say as one of your duties we'd like you to be
00:35:26.200 happy right you create value for the company that justifies what they pay you or you
00:35:32.560 don't have a job and it's great for us to want to be happy and I am happy programming Ruby code and I would like
00:35:39.200 many many people to continue to be happy programming Ruby code but if we don't allow the
00:35:45.680 stakeholders a say if we don't let them talk about
00:35:51.240 things and decide things then they'll say okay fine I have a lot of money I
00:35:56.720 can make my own that's already happened so far no one has been willing
00:36:03.880 to say you know what actually I'm not just making implementation of Ruby but I'm going to make my own implementation
00:36:10.040 of Ruby and that's the thing that really scares me so the Ruby design committee
00:36:16.839 is not just random I think that it needs to be a committee of representatives from
00:36:22.240 implementations and the reason for that is that when we get to these actual things people who actually have a vested
00:36:29.760 interest we will do far less random and
00:36:35.680 irrelevant discussions about things and much more focused work I think that a
00:36:41.000 proposed change to Ruby coming from one of the Ruby design committee members or Representatives has to include these
00:36:47.920 things number one documentation we don't just write some code and and say this is
00:36:54.640 a feature that I like here it is play with it we Define it in documentation
00:37:00.640 that people can read and discuss it must have Ruby speec coverage it must have an
00:37:06.400 implementation by all members of the committee all members of the Ruby design
00:37:11.640 committee after the implementation is where we debate things and finally we
00:37:17.160 vote and it's a consensus no one says well we really
00:37:22.400 like this you don't like it too bad part of making the case is actually
00:37:28.240 showing this code in these libraries or this application or this way causes
00:37:34.839 these consequences and these costs if we change it we would have this
00:37:40.680 sort of thing the number one thing that we need to avoid is bike shedding which is
00:37:47.680 wasting an enor amount of time on totally irrelevant details or having people come in and say Ruby really needs
00:37:53.119 types types don't make sense in Ruby there are a ton of typed programming anges out there we don't need them for
00:37:59.200 we don't need them for performance we don't need them for code Clarity we don't need them so I want to avoid in
00:38:06.160 this my my ideal World here of of Ruby design I want to avoid this as much as
00:38:12.880 possible adding documentation is the first way of making
00:38:18.119 it so someone can't just drop in and say yo what about adding like optional typing to Ruby which has happened
00:38:23.560 repeatedly on Ruby core the second thing is that if we add Ruby specs then we have a way to
00:38:30.040 communicate with all the implementations and actually run code and check and see if it
00:38:35.880 works and the reason that I insist on Ruby spec here is an example of code from the MRI tests and a couple problems
00:38:43.359 with this are I can't understand it that's the first problem it's got
00:38:48.680 embedded in it things like bugs in MRI which have no bearing whatsoever on Ruby
00:38:53.880 it's a bug in MRI the implementation um it combines a whole
00:38:59.040 bunch of stuff into one thing and it doesn't have very good
00:39:04.319 coverage this is ruis specs coverage for string.io gets these are the tests for string.io
00:39:10.440 gets so if you want to learn about more about ruis speec please visit rubby spc.org but I think that Ruby speec is
00:39:18.200 vital to making the Ruby design process better because it cares about implementations it has first class
00:39:25.440 support for implementation and the differences that may exist and may have to exist between implementations because
00:39:32.040 what someone's using to implement Ruby May simply not give you something that you need and so there has to be a way to
00:39:38.319 say on this implementation this can't happen or it has to happen this way it has explicit support for platforms there
00:39:45.359 are a lot of platforms that run Ruby and there are a lot of differences between those platforms and what they're provided in the ca ca C lib API and then
00:39:54.520 there are support for versions just because Ruby 2.0 comes out and a bunch of people go and use Ruby
00:40:00.880 2.0 does not mean that all the people that invested money and paid people to write applications that run on Ruby 1 19
00:40:07.520 have money to pay those people to go make sure it runs on 2.0 if we do not respect the investment that people have
00:40:13.680 made in Ruby and Ruby applications we will not have respect from those people and they will not be very likely to say
00:40:20.280 you know what it's a great idea that you want to write my new application in Ruby I I received such uh respect for my
00:40:26.200 investment last time I would like to you to do that again I want people to say that but they're not going to say that if we don't respect the the the uh the
00:40:32.760 investment that have people have made in previous versions and finally the debate after
00:40:37.920 implementation means that we get to talk about what actually matters I've implemented this to the best of my
00:40:44.240 ability check my implementation I don't think there's bugs passes all of Ruby spec and it has this adverse consequence
00:40:49.960 which I think is a deal breaker these sorts of discussions can actually talk we can actually have those after
00:40:56.040 implementation and for supporting technology we need a way to talk about
00:41:01.119 stuff that doesn't result in this uh email uh mailing lists and forums that
00:41:08.599 thread things like this hurt my brain so badly I cannot deal with it um well
00:41:14.880 there has to be a way to say on this point of this implementation these are the responses these things make sense
00:41:20.960 not this threaded but then you responded to this and then I respond this is just a very short threat and I picked Hacker News because it has a horrible interface
00:41:27.480 I think I I don't know people spend a lot of time on Hacker News I don't honestly don't know how that works but I
00:41:32.720 think that we need uh technology to support it we actually need an application that discusses um proposed
00:41:39.440 changes to Ruby and has ways to like check off all the things that we need to do the reason that I don't think Ruby
00:41:45.800 core is sufficient is because it's a mailing list that mixes MRI bugs with other
00:41:51.319 features and the volume is overwhelming and I thought it was just me until I saw
00:41:56.400 Charlie say oh I started looking at Ruby cor again and then they went on a big bug sweep and I'm like yeah I can't read
00:42:03.000 all of that stuff it's so much stuff and I do want to participate and finally discussions have
00:42:11.119 to happen in English not all the discussions and I'm sorry if this sounds
00:42:16.400 culturally imperialist or something but the fact is that the language that we typically use to discuss things is
00:42:23.680 English we can all disc if the if a Russian teach made an implementation and they discussed all of their
00:42:29.880 implementation stuff in Russian and then came and said okay here's what we think
00:42:35.000 that that dialogue right there has to happen in English because that is the language that the vast majority of us
00:42:40.720 share and the things that have been discussed completely in Japanese um before have been very very challenging
00:42:47.880 for us to understand and us to implement so this is the
00:42:53.680 proposal you make a proposal you add Ruby specs you do the implementation
00:42:59.200 there's a discussion and there's a vote that's my Pie in the Sky vision of what a ruby design uh committee and process
00:43:06.119 would be JFK said those who make peaceful
00:43:12.119 Revolution impossible make a violent revolution inevitable we've seen that happen in the world I say those who make
00:43:20.440 collaboration impossible make forking inevitable since I started working on
00:43:26.119 Ruby speec years years and years ago my number one concern and before I was even willing to contribute to rubinius was
00:43:31.800 that Ruby itself as a language in a community did not get fragmented and split apart by competing interests that
00:43:38.800 we maintained Ruby as a language that brought everybody together I don't want
00:43:44.240 to see this happen even more importantly I was having a discussion
00:43:50.440 with somebody the other day and they said you know I've always wondered what a dying open source project looks like
00:43:56.559 and I thought because we were actually talking about Ruby at that time I wonder what a dying language looks
00:44:04.160 like please don't let Ruby die it's a beautiful language I love Ruby very much
00:44:09.480 and I think most of us do so here's my conclusion matoto thank you very much
00:44:16.040 for Ruby it's a beautiful powerful language it brings many people such Joy your
00:44:23.359 creation is a gift to the world a ruby is is now over 18 years old
Explore all talks recorded at RubyConf 2012
+46