Salient Solutions

wrasslin ones and nones for fun and profit - Sky Sanders' Blog
Get your own ranked flair here
posts - 88, comments - 54, trackbacks - 0

Generics

There are 2 entries for the tag Generics
A Better JavaScript Generic Type Implementation

download source code download this article in .doc format. Overview In a recent article I presented a simple implementation of a generic type system in JavaScript. Please see that document for a detailed enumeration of the motivations and benefits, including type safetly and Visual Studio intellisense support. In this document I will present a 'better' implementation that eliminates many of the limitations of my 'simple' generic type implementation. I will also provide a starter library of generic compatible collections including Queue, ListArray and Dictionary that you may use immediately and that can serve as a reference for implementing your own generic types in JavaScript. Features: ...

posted @ Wednesday, August 19, 2009 5:40 PM | Feedback (1) |

A simple JavaScript generic type pattern implementation

source and demo What are 'generic types'? A generic type is defined using one or more type variables and has one or more methods that use a type variable as a placeholder for an argument or return type. For example, the type java.util.List<E> is a generic type: a list that holds elements of some type represented by the placeholder E. This type has a method named add(), declared to take an argument of type E, and a method named get(), declared to return a value of type E. source Why attempt this in JavaScript? My answer is two-fold. Primarily for type safety. While the...

posted @ Tuesday, August 11, 2009 12:43 PM | Feedback (0) |

Powered by: