Skip to content

Instantly share code, notes, and snippets.

@DmitrySoshnikov
Created May 17, 2011 18:19
Show Gist options
  • Select an option

  • Save DmitrySoshnikov/977034 to your computer and use it in GitHub Desktop.

Select an option

Save DmitrySoshnikov/977034 to your computer and use it in GitHub Desktop.
Classification of classes
// by Dmitry Soshnikov <dmitry.soshnikov@gmail.ru>
// MIT Style License
*Classification of classes:*
=============================================================================
| Dynamic | Static
-----------------------------------------------------------------------------
| |
| Coffee, Python, Ruby, | SmallTalk, built-in
First-class | JavaScript (w/o sugar), etc. | classes of Python, etc.
| |
-----------------------------------------------------------------------------
Second-class | PHP, etc. | Java, C++, etc.
-----------------------------------------------------------------------------
P.S.:
A *first-class* value -- the value which may participate as normal data. E.g. can be created literally
at runtime, passed as an argument, or returned as a values.
2. A *second-class* value (or a *first-order* value) -- the value which is not the first-class value.
*Note*, second-class values can be used partially as first-class values, e.g. passed as arguments
(an example -- pointers to functions in C/C++). So the most important difference of a first-class
value is the ability to be created at runtime and in particular cases to be used as objects.
Regarding functions, "first-class-ness" is also related with static scope, i.e. the ability of
functions to be *closures*.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment