text
stringlengths
0
1.17k
[1395.66 --> 1400.46] all but here's the alternative and they actually encourage the alternative the problem is the
[1400.46 --> 1407.32] alternatives such as mixins interfaces yep they have so many built-in problems themselves that they
[1407.32 --> 1412.66] didn't actually solve the underlying problem so the traits researchers we call them roles in pearl because
[1412.66 --> 1418.32] traits is actually a term for a different thing what the traits researchers did is they were
[1418.32 --> 1422.66] funded to investigate the problem come up with solution and what they discovered was classes actually
[1422.66 --> 1429.60] have two roles as an agent of responsibility your employee class as your system grows has to take
[1429.60 --> 1436.54] on more and more and more behavior but if you're going to inherit from your employee class then it's an
[1436.54 --> 1441.54] agent of code reuse and quite often for code reuse we don't want all that behavior we just want little
[1441.54 --> 1446.72] specific bits and pieces and in fact there's a language called beta which was going to implement
[1446.72 --> 1451.16] multiple inheritance but when they researched it they found out that almost everyone using multiple
[1451.16 --> 1455.48] inheritance wasn't for creating more specialized classes it was just to pull out bits and pieces of
[1455.48 --> 1461.04] parent classes so the reality is for code reuse you actually want smaller code because you just want to pick
[1461.04 --> 1466.06] out the bits and pieces you need but for class responsibility you need all of that so classes actually serve
[1466.06 --> 1473.40] to do a role reuse and responsibility and the problem we've had with inheritance and the solutions such as
[1473.40 --> 1481.60] interfaces and mixins has been you need to decouple those so roles has decoupled them entirely and so classes are
[1481.60 --> 1486.48] agents of responsibility so an employee might have an employee number but does an employee know how to
[1486.48 --> 1494.88] serialize itself to xml or json no it doesn't this is a bit of behavior which could be shared amongst classes
[1494.88 --> 1501.06] which are not necessarily related by inheritance so ruby mixins which actually came from a variant of
[1501.06 --> 1508.90] lisp called flavors ruby mixins actually properly separate behavior from responsibility but unfortunately
[1508.90 --> 1515.80] they implemented it via single inheritance so if you mix in a couple of modules into your ruby code and
[1515.80 --> 1521.36] then you call ancestors you'll find that it's implemented as a single inheritance tree and then you wind up with
[1521.36 --> 1526.90] strange bugs so in if you have duplicate methods in multiply inherited classes the first class you
[1526.90 --> 1535.06] inherit from generally wins in ruby the last mixin that you've mixed in wins with roles it's completely
[1535.06 --> 1540.10] different it says oh i'm sorry you have duplicate methods they have the same name it's going to fail
[1540.10 --> 1544.74] at composition time close enough to the pile time most people won't notice the difference it'll fail
[1544.74 --> 1549.58] composition time says i don't know which of these methods you need so you specifically say i want this method
[1549.58 --> 1556.76] from this role i want this method from that role and you don't have any of those composition issues
[1556.76 --> 1561.90] that you have with multiple inheritance or mixins or some of the other solutions which are out there
[1561.90 --> 1567.68] there's a lot more i can say about them but this is one of the finest things about roles it cleanly
[1567.68 --> 1573.36] separates class responsibility from code reuse and more and more developers are finding out that you can
[1573.36 --> 1579.12] eliminate inheritance entirely and build an entire large-scale object-oriented system just by
[1579.12 --> 1584.16] composing different roles and saying i want this behavior that behavior the other behavior and you
[1584.16 --> 1588.52] get composition safety because you don't have to worry about method conflicts anymore you don't have
[1588.52 --> 1592.56] to worry about accidentally inheriting a method that you didn't realize that you were inheriting
[1592.56 --> 1599.64] and it makes things so much simpler it sounds like a pretty big win so is that available in pearl 6 today
[1599.64 --> 1604.80] it's available in pearl 6 today it's available in pearl 5 via something called moose roles there's some
[1604.80 --> 1610.14] other role modules out there i have one myself which is actually goes back to the original research
[1610.14 --> 1617.46] on this there's some guarantees that roles actually provide such as being commutative and associative
[1617.46 --> 1622.84] basically mathematical guarantees to get around some of the issues that you had with inheritance and
[1622.84 --> 1630.90] mixins and different systems meet those guarantees in different ways but it's available out there but many
[1630.90 --> 1635.30] other languages have this i know there's been some experiment with java to do this there's been
[1635.30 --> 1642.30] some experiments with python to do this i'm pretty sure it's available in ruby javascript has something
[1642.30 --> 1647.36] i believe called juice which i had heard about i don't know how far along that is which also
[1647.36 --> 1654.20] makes roles available so there's a wide variety of languages which have adopted it but you know how much
[1654.20 --> 1658.12] people are actually using it it's hard to say but the pearl community has bought into it wholesale
[1658.12 --> 1663.00] because it tremendously simplifies your code and makes it much easier to understand
[1663.00 --> 1670.10] pearl 6 sounds very it sounds very experimental and research oriented is it run by the same group
[1670.10 --> 1678.12] of folks that are doing the pearl 5 stuff or are they also diverged um yes and no does that help
[1678.12 --> 1685.94] uh nope please explain i'm glad i can clarify that so lary wall the founder of pearl um has shifted
[1685.94 --> 1692.38] focus from pearl 5 to pearl 6 and many people now call pearl 6 rakudo just to distinguish it from
[1692.38 --> 1700.58] pearl 5 would you say rakuda rakudo r-a-k-u-d-o interesting earlier on i was thinking man maybe it just
[1700.58 --> 1706.34] needs a separate word like a separate term altogether yes and i would like to see that term adopted a
[1706.34 --> 1712.30] little bit more widely but yeah there's there's a lot of background to that um and pearl 6 the name's
[1712.30 --> 1717.20] been around for so long that they've stuck with it right so there's that marketing thing about you
[1717.20 --> 1723.42] know don't shift your name because you'll lose people so possibly that's some of it yeah anyways
[1723.42 --> 1729.76] you were saying so larry wall uh has shifted his focus from pearl 5 to pearl 6 and has been pushing
[1729.76 --> 1736.84] it forward and it's just making tremendous strides damian conway uh he wrote uh pearl best practices and
[1736.84 --> 1740.68] quite a number of other excellent books uh involving pearl including object-oriented pearl
[1740.68 --> 1747.20] and he has also been doing a huge amount of work with this but many people such as uh patrick michaud
[1747.20 --> 1753.74] who was heavily involved with php and others carl msak many others have been heavily involved in
[1753.74 --> 1760.26] pushing pearl 6 along jonathan worthington he was a pearl 5 hacker but mostly focuses on pearl 6 now and
[1760.26 --> 1764.46] he's been doing a lot of work putting it on the jvm and writing something called more vm
[1764.46 --> 1770.42] so there's now originally it was a bunch of pearl 5 hackers now there's a completely separate
[1770.42 --> 1775.16] community of people from a variety of different backgrounds many of them academic many of them
[1775.16 --> 1780.14] uh basically you know heavily involved in the real world who have been building pearl 6 many of whom
[1780.14 --> 1787.00] have no background in pearl 5 anymore so is pearl 6 out there in production or is it still kind of at a
[1787.00 --> 1792.30] at an experimental phase i do know there are some folks who have been using it in production
[1792.30 --> 1798.76] generally they're using this for smaller tools the sort of small tools that you might uh build shell
[1798.76 --> 1803.34] scripts for because that's a little bit safer a little bit lower risk uh large-scale systems
[1803.34 --> 1810.64] are generally not being built in pearl 6 yet um there is more work to be done with the final work for
[1810.64 --> 1817.88] porting it to more vm and the jvm to finally get a production ready there's more i can say about that
[1817.88 --> 1824.90] but i don't know how much i'm actually allowed to say uh simply because um for the long time
[1824.90 --> 1829.00] pearl 6 has always been promised by christmas but we just don't say which one
[1829.00 --> 1835.00] yeah i'm reading some commentary behind the scenes here just sort of listening to you by the way i love
[1835.00 --> 1841.98] that explanation of roles versus inheritance that was um really great but some some thoughts here from
[1841.98 --> 1847.90] reddit i'm not sure that's the best place to go for thoughts but um it seems like people have this
[1847.90 --> 1852.36] huge question in the brook community about what's happening worth pearl 6 then even specifically
[1852.36 --> 1859.02] larry wall you've mentioned a couple times and whether or not it's uh they've questioned um the code
[1859.02 --> 1865.50] quality uh or sorry the language designs not so much code quality but uh some other things happening
[1865.50 --> 1870.84] there it seems like stepping back to earlier you mentioned this you know maybe it's not so much
[1870.84 --> 1875.18] marketing maybe it's communication and that's where i feel like having you on the show today and
[1875.18 --> 1880.24] just sort of getting this bird's eye view from uh someone inside the community that's been there for a
[1880.24 --> 1886.04] while that's sort of as you said uh by accident to a degree a happy accident that you can sort of
[1886.04 --> 1891.86] disseminate this idea of what pearl 6 is going to be and what profile is doing currently because
[1891.86 --> 1898.62] uh to rewind just a tiny bit you mentioned you had a role a role um roles and pearl and i believe
[1898.62 --> 1906.46] it's role basic is that your is that your version of roles yes there's there's a second traits paper
[1906.46 --> 1912.58] um let me see the typed calculus no a traits the formal definition i think is the name which despite
[1912.58 --> 1918.56] the name is actually a fairly easy to read paper which unfortunately i consider to be the traits paper
[1918.56 --> 1923.70] that no one has ever read but should um and it's absolutely fantastic and it clears up a lot of the
[1923.70 --> 1928.60] communication i've actually spoken with a number of traits researchers to clarify some of the issues in there
[1928.62 --> 1935.34] um and traits themselves still have some issues um i should call them roles just because that's what
[1935.34 --> 1940.40] pearl does they still have some issues because this is programming and in programming we don't have
[1940.40 --> 1945.56] perfect systems anywhere but they are the best thing to come along and i have worked with you know so
[1945.56 --> 1951.18] many alternatives and they do solve so many problems but yes i wrote role basic in an attempt to
[1951.18 --> 1958.44] create a system that goes back to the original definition and truly respects uh some of the rules
[1958.44 --> 1964.92] such as uh you know being commutative and associative for example if you have a role which uh does json
[1964.92 --> 1973.18] serialization and you have a role which uh does i don't know yaml serialization and if you compose
[1973.18 --> 1979.18] both of those roles they should it doesn't matter which order you compose them in unlike you know inheritance
[1979.18 --> 1986.90] or mixins it's guaranteed you get the same behavior technically it is possible to violate this contract
[1986.90 --> 1995.06] uh with roles or if you have the role which does json serialization consumes another role which does