kingcons / study-group

A coordination point for curricular coding :)
3 stars 3 forks source link

Week 8 - Section 2.5 (09/26) #12

Closed kingcons closed 5 years ago

kingcons commented 6 years ago

Week 8 - Section 2.5

Group Leader of the Week

:clap: :tada: :heart: @kingcons :heart: :tada: :clap:

volunteer

Meeting Details

This will be our last meeting at the headquarters of Tourbuzz/Showcase IDX. I have put in my notice and will be joining Flatiron School as the Lead Instructor at their new Atlanta campus. πŸ™Œ

Unfortunately, this will necessitate finding a new venue for us to meet. I vote for somewhere we can hear each other and see a laptop screen and, potentially, drink beers. Synthesizers optional. Maybe even my house in EAV? (Read: Beers and synths. 😱) But I might not be able to make 6pm sharp once classes start at the end of October. Also, that might be bad location for Matt due to Moebius. Thoughts? 🍻 πŸŽ›

Section Details

2.5 - Systems with Generic Operations

Section 2.4 showed us three different strategies for performing dispatch based on data type:

  1. Having procedures use type tags in data to decide what to do based on the type of data received.
    • This requires adding a branch to every procedure one might use whenever a new type is added.
  2. Having an explicit dispatch fn (apply-generic) that looks for the "right" procedure in a table.
    • This requires storing the procedures in the table but helps supports "multimethods" / multiple dispatch where you can choose the function to run based on the type of all of the arguments instead of just one (i.e. "Single Dispatch" as seen in Ruby, Smalltalk, Java, Python, etc).
  3. Having the data constructors explicitly embed the procedures in each datum/instance. This is similar to a traditional single-dispatch object system or message passing system.
    • Note: In "real world" single-dispatch systems, the procedures aren't literally stored within the objects as in the naive Scheme example. See: C++ vtables, Javascript Prototypes, etc.

Section 2.5 will continue on from this point exploring how to combine dispatch with interfaces to achieve full polymorphism and explore issues around larger type (or "class") hierarchies. I say "full polymorphism" because previously, even when we did dispatch on type tags they were different representations for the same data. Now, we'll see how to make addition do "the right thing" based on whether it's argument was a number, ratio, complex number, etc. Afterwards, we'll be in good shape to explore assignment/mutable state in chapter 3 to approximate "real" objects.

The Planning Thread

We'll use this github issue as a discussion thread for:

kingcons commented 6 years ago

A) Wow, I actually wrote a good issue. B) We still need to discuss exercise 2.76 some at the beginning of the next meeting. :)

kingcons commented 5 years ago

In spite of my doing none of the exercises this week ( 😞), this was a great meeting! Shoutouts to @bigjust for having worked through the chapter and leading discussion. Also, the discussion around exercise 2.76 from Section 2.4 and Footnote 118 from 2.5 was pretty dope. :sunglasses: