[Vm-dev] FilePlugin argument checking - primitiveFailed vs PrimErrBadArgument

Alistair Grant akgrant0710 at gmail.com
Sun Mar 4 11:24:41 UTC 2018


On Thu, Mar 01, 2018 at 02:20:23PM -0800, tim Rowledge wrote:
> 
> > On 01-03-2018, at 11:21 AM, Alistair Grant <akgrant0710 at gmail.com> wrote:
> > 
> > Hi Everyone,
> > 
> > I'm currently extending FilePlugin to allow files to be opened using
> > either a file descriptor or FILE*.  
> 

> If you have some time, and the interest, to do stuff for FilePlugin 
> then please, please, consider doing a real rewrite. For some time (as 
> in "since 1997") we've needed better file connections. The original 
> file primitives (way befor eplugins were even imagined) were written 
> to make use of the most basic posix library. Thus we get the utter 
> insanity of the 'set file pointer' and 'write to file pinter' 
> separation.
> 
> It would be nice if the prims that need a file name would only accept 
> instances of a class specifically for filenames, so we can separate 
> out deriving the file path from plain String stuff. It would be nice 
> to have a prim that asks the OS to canonicalise the name - ie take 
> 'fred.jpg' and work out the full, exact, name for us. RISC OS has a 
> nice call to do exactly this [1] and it's hard to imagine other OSs 
> can't do the same; after all they have to do it at *some* point 
> anyway. I guess the prim could fail if needed and defer to image code 
> that tries to do The Right Thing.
> 
> Merging in your file attributes would be nice. Dave Lewis did some 
> directory related plugin stuff a while back. Being able to read & set 
> modes and permissions and metadata would help. That ancient and 
> horrible FileCopyPlugin I wrote? Needed only because you couldn't read 
> nor write such stuff and it was essential to copying vmmaker related 
> scripts etc.
> 
> We ought to do so much better. There have been plenty of discussions 
> over the years but no real change. Maybe you can effect some?

I'm a little nervous about taking on a complete rewrite of FilePlugin at 
the moment. :-)  I agree with your comments about being able to set file 
attributes, and they are a practical small step that can be taken.  It 
is also reasonable to add that functionality to FileAttributesPlugin.

Dave, I took a quick look at DirectoryPlugin and it looks like there 
isn't any support for setting file attributes there.  But please correct 
me if I'm wrong.

There's also ongoing discussion within Pharo about rewriting the file io.  
I haven't been part of it, so I don't know if it included the 
primitives or just the class hierarchy.  But I'm happy to take a look 
and see what can be done.

I want to get the FileAttributesPlugin smalltalk code integrated in to 
Pharo first.  I'll look at being able to set file attributes after that.

Cheers,
Alistair


# vim: tw=72


More information about the Vm-dev mailing list