steep icon indicating copy to clipboard operation
steep copied to clipboard

Enhancement: Move type declartions directly into .rb files

Open mcandre opened this issue 6 years ago • 0 comments

Gentle petition to keep types as close to the variable declarations as possible. Done in the right way, this provides a wonderful balance of power and reliability.

For example, in Haskell, types do most of the work. That's for an ML-style language with functors and monads, where types are essential for higher quality, self-documenting and self-testing work (see QuickCheck).

For Ruby, an OOPL, types are potentially even more powerful, as the little . dot operator unlocks a directory of what methods and transformations to do next on a value. The programmer can simply build up programs from method chains and see instantly which methods are available for use. All powered by types.

I think it is easy to come up with a bad type system, even an ugly one. But Ruby is already an excellent language and deserves a Haskell-like type system: Types should be optional, and the interpre-compiler should merely spot check that the programmer is naming valid types.

mcandre avatar Nov 19 '19 21:11 mcandre