@codebrainz: You consider it a very rare problem, but if you think again about 
my example of files being locked accross a Network share, this is not so rare.

If I just want to protect myself from locking a file on my own disk, I can use 
tools like LockHunter to find the process which is doing the locking, and force 
the lock to go away (which at least often is the right thing to do anyway), but 
this would not work with Network shares.

I understand your argument about compile-time type safety in your C code, but 
even if you followed my suggestion of going va_arg, you give up type safety 
only for one (i.e. the last) parameter in the signature of only one function. 

If you consider this too dangerous, you can still use cover-functions, which 
are type safe: You rename the existing 'save(X,Y,Z)'  into a 
'save_general(X,Y,Z,bool)', and then define two functions 'save(X,Y,Z) and 
'save_nonmodal(X,Y,Z)', which just forward to save_general, but have different 
parameter signatures. If you do this, you stay typesafe, and existing 
applications just have to be recompiled. Only inside that one plugin, we have 
to call 'save_nonmodal' and implement an appropriate error handling.

Maybe an alternative way would be to offer in the plugin configuration a 
checkbox, that, if selected, causes the auto-saving NOT do be done on files 
residing on a Network share. This would be simpler to implement (since we don't 
have to care about error handling), but at the cost that it might need some 
verbosity to explain to the user, why selecting this checkbox might make sense.

---
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/issues/815#issuecomment-165094944

Reply via email to