On Aug 17, 5:36 pm, TIG wrote:
> So... if I understand correctly... it's a great idea but it just won't
> work because a suitable framework is not in place...
Well .. the foundations for a framework are in place. But the the ruby
methods have not been added into the package, yet. (And it's not that
difficult.)
> You recommend sub-
> classing to a new class based on the V1 - say V1_1 but it'll not work
> as the DCloader never looks for more than V1 - as it IS the current
> V1.
Actually DCloader loads the DCObservers singleton class (which really
should be called "DCManager", as it's not an Observer itself, it
manages the whole system.)
It's the DCObservers object that hardcodedly (currently,) only loads
DynamicComponentsV1, which again in hardcode explictly loads
DCFunctionsV1.
> I still fail to see how this could work without lots of extra files
> loading and changing some existing files that ship with standard
> Sketchup -
NO... not really. Extra files yes.. but they will NOT change the
existing class versions (and therefore the files of ver 1.0.) They are
subclasses that inherit all the previous version's functionality, but
simply change the values of a few instance variables, and add new
methods. (Forget about patching the DC bugs, for this discussion, it's
a different issue. Lets stay on the subject of extending the DC system
with new versions, that add new functioanality.) So creating a
subclass file, will only take a handfull of lines to implement.
> so it'd be even more questionable than 'carefully' adding
> methods to an existing class...
NO... it won't because it's the way that Scott intended it to work in
the future. (He just did not have the time, or the budget for V1
didn't allow him to, ... fully implement the extensibility he
envisioned.)
> None of the existing .rb's code will do this and as far as I can see
> it would mean messing on in the sacrosanct Tools and its subfolder/
> files...
Well.. you know that I'm very much against "dropping" scripts into the
Plugins dir, where they end up living on forever. Most especially a
"hack" like you posted. Months, or more from now, a user won't
remember it's there, and will wonder what is changing his DC's
functionality. He may not even remember where he got it. (One reason
why this group is a bad place to post code snippets. We cannot edit
them here.)
I would implement this as a SketchupExtension, that can be totally
turned off at will. And then the "DC Extensor" would be a similar sub-
system, where you could decide what versions to load or not.
Secondly, I would probably put it in it's OWN subdir of the Tools
folder. I would not mix anything into the DC subfolder tree. Nor would
I need to change any of those Google files in there.
> As many people might write new functions then shouldn't these go into
> the V1 class [as the most current 'official' class]?
NO again... if anyone does that... the class is no longer V1 !!!
(It's no different than, if I walk onto construction site, grab a saw,
and cut a new doorway thru a wall, because I personally believe there
should be a door there. l may have good reason to think a door should
be there, and others may agree. But if there's no door at that
location in the plans... was the building built to plan?)
> When you add a new function [in a way that preserves any future
> changes to the existing [V1] class methods] the DC will then work if
> that .rb loads those methods.
Which is acceptable ?? A system of proper versioning, configuration
management, and controlled releases... or everyone and anyone willy-
nilly making changes.
> If it doesn't work because it's been
> disabled or simply not installed, then the DC will fail with an error
> messages saying something like "undefined method 'playsound'"...
There is a trap for "Unknown Function"... but a trap by it's nature is
meant to prevent a runtime error from causing the code to exit
ungracefully. Circumventing the way things are supposed to work, may
cause the trap to fail. The trap is meant to prevent (or hide,) the
Ruby exception.
> If Google decide change the way DCs load and use versioned functions
> in SU0+ then they will also need to address backward compatibility ??
I believe Scott already addressed this in the code.. but the
versioning system needs to be respected. Period.
> The adding of customized functions into the base V1 class 'carefully'
> will work...
IT WON'T because obviously, you cannot see (or have not seen,) how the
code is written. (The copyright, and the NDA I signed, prevents me
from sharing it with you. Sorry.) It seems that your motivation is
that your unwilling to wait, for the proper framework.
> and the only possible clash is if someone else's DC
> defines its own functions with the very same name but that do
> different things - only one will load and the other will fail or
> produce odd results...
Obviously.. there needs to be some community review for new candidate
functions, and beta testing. (Which means the system must support beta
versioning.) Then an official release of new function sets.
So my answer to having many people hacking out new functions, and
releasing them at will, is a recipe for disaster.
And I wish you, in hindsight, had not publically posted that "hack."
The DC system is a VERY complex system. The last thing we need, is to
be teaching "newbies" how to hack or short-circuit a package this
complex and important. The DCs need to really be thought of as part of
the Sketchup application. If this hacking gets out of hand, I would
not be surprised if (in the future,) it gets compiled into a DLL, or
similar, where dynamic changes are not possible.
I am reminded of a snarky jab made in the SCF forums last beta cycle,
by Mr. Hauswirth, concerning his distaste for hacking where we should
not.
> I suppose the conditional def of the new functions could have a
> UI.message box telling us if it's already defined and recommending a
> check on affected DCs operation - ..[snip]...
I would hope that we could get Scott involved, as "editor in chief" or
whatever, like how a project engineer has to sign off on the drawings.
A new package doesn't get released until he OKs it