4 ms·
I imagine an ada dev would find the pattern grating over the decades, so it reads like an expression of that experience.
by mcdonje 6mo ago
I imagine an ada dev would find the pattern grating over the decades, so it reads like an expression of that experience.
- OneWingedShark 6mo agoYep. And sometimes it's hype over the weirdest things... a good example "dependency injection". Generic Type Index is (<>); -- Any discrete type. Type Element is limited private; -- Any non-discriminated type. Type Vector is array(index range <>) of element; -- An array-type of Element, indexed by Index. with Function "="(Left, Right: Element) return Boolean <>; -- Equal, defaulted. with Function "<"(Left, Right: Element) return Boolean <>; -- Less-than, defaulted. Function Generic_Sort( X : Vector ) return Vector; Now when we instantiate we can inject '>' in place of the '<', reversing the direction of the sort: Function Sort is new Generic_Sort( Index => Integer, Element => Integer, Vector => Integer_Array, "<" => ">");