The tag has no wiki summary.

learn more… | top users | synonyms

2
votes
3answers
90 views

An attempt at a simple type safe python enum

There have been many posts here about enums in python, but none seem to be both type safe and simple. Here is my attempt at it. Please let me know if you see anything obviously wrong with it. def ...
2
votes
1answer
57 views

Pythonic type coercion from input

My context is a very simple filter-like program that streams lines from an input file into an output file, filtering out lines the user (well, me) doesn't want. The filter is rather easy, simply ...
1
vote
3answers
111 views

Can I somehow tidy up this (overuse?) of generics?

I'm building a generic flat file reader which looks something like this. public class GenericReader<TComposite, THeader, TData, TTrailer> where TComposite : GenericComposite<THeader, ...
1
vote
0answers
67 views

Imroving GADT type-safe code for AA trees

As an exercise on GADTs I wrote a type-safe implementation of AA trees. I'm quite happy that the AANode data type correctly grasps the properties of the tree. Just from the type it can be concluded ...
1
vote
1answer
278 views

Loading an Object from File with Type-Safety and Thread-Safe access

I'm attempting to write a bit of code that allows for easy and safe access to objects in a file. It seems to work great but I was curious if there was an easier way to do this or if Java already has ...
3
votes
2answers
2k views

Type-safe Dictionary for various types

Assume the following situation: you have an object that can store any object based on a key (basically, IDictionary<string, object>). You want to store objects of various types into it that are ...