Hi all,

I myself have met a similar need for a file object.  That way, I can use 
the dispatch engine to overload the open function:
f = File(format"test.jpg")
s = open(f)

instead of what I consider to be less attractive solutions:
f = "test.jpg"
s = open_jpeg(f)
#or
s = MyModule.open(f) #My module's JPG reader

I like the idea of the FileIO module, but I am less a fan of having to 
register new filetypes with the module.  ...Yet I must admit there is 
something nice about how FileIO appears to automate type creation (Sorry: I 
do not fully understand the module yet).

I played a bit with FileIO, but something seems a little off about how I 
use/generate objects (I'm not sure why that is, though).

Anyways, I tried getting similar functionality (attempts at solving my own 
problems dispatching read/open on different file types) by relying more 
heavily on the Julia type system:
https://github.com/ma-laforge/FileIO2.jl

Comments:

   - FileIO2 does not have as many bells & whistles as FileIO - but I think 
   it has potential for that.
   - FileIO2 even has facilities to dispatch on different file encodings 
   (ex: binary, UTF8, ASCII, ...) if one would desire such a thing (Though I 
   prefer not to do so, in most cases).

Sample Code:
#Generate a reference to a text file:
file = File{TextFmt}("generictextfile.txt")

#Easily display the entire contents of an ASCII file:
typealias ASCIIFile File{ASCIIFmt} #For convenience
print(read(ASCIIFile(@__FILE__)))

...So I figured I would just put this out there in case the FileIO group 
finds something of value in the FileIO2 solution.

MA

Reply via email to