mna / agora

a dynamically typed, garbage collected, embeddable programming language built with Go
https://github.com/mna/agora/wiki
BSD 3-Clause "New" or "Revised" License
324 stars 27 forks source link

Better way to detect bytecode files #39

Open mna opened 10 years ago

mna commented 10 years ago

Currently, bytecode.IsBytecode() only works for io.ReadSeeker types, but the Ctx.Load() can only guarantee an io.Reader. Other way to do this?

BenLubar commented 10 years ago

You could do some combination of bytes.NewReader and io.MultiReader.

mna commented 10 years ago

I see what you mean. Read the signature bytes, create a reader off of those bytes, and combine those bytes with the rest of the reader using a multireader. Sounds like a good idea, thanks!