Creating reusable code libraries

MisterX b.xavier at internet.lu
Sun Nov 21 13:14:04 EST 2004


> Dear Revolutionaries
> 
> I have some newbie questions ...

Nothing is newbie, everything is a different view!

> What would be the best way in Rev. to create a reusable code 
> library - e.g. to do 3D mathematics?
> Would I create it as a stack script in an otherwise empty 
> stack and then load the stack into my apps and keep it 
> invisible? Do all stacks have to have a toplevel window?

You go it...

Open the revdocs and read up the start using <stack>, the library command
and eventually the frontscript and backscript. It's not much but it opens an
infinite amount of extensibility to RunRev. And these are the libraries you
seek...

> I am still a little unclear on the relationship of stacks, 
> substacks and cards. Supposing I have created a mainstack 
> already - what is the difference between adding a new card to 
> the mainstack or adding a new substack? Stacks and substacks 
> both have to have at least one main card - yes? How is the 
> relationship of a substack to its stack, different from that 
> of a card to its stack (or substack)?

Think of a stack file as a stack of cards (each with controls or pictures).
Since MetaCard, we can put a stack of cards into another without getting
them mixed as if we put in a compressed file inside another compressed file.
Independent but always handy to call.

Substacks are best used as answer dialog front end or small editor windows
for a particular case like avoiding clutter that your application can easily
call. You can simulate a file open interface or things like a list chooser. 

> How could I draw graphics with code rather than interactively 
> with the graphics tool? Supposing I wanted to e.g. draw and 
> show a contour map of a terrain from a numerical set of 
> coordinates and elevations provided by a surveyor?

You could use the graphic tools and input it data. I've done some extensive
line graphs with that. It's nice because it's editable.

But for the most part, either you will have to draw all the lines (a lot of
lines), use a paint object and paint the graphics (smaller memory footprint
but not editeable as a numeric graphic control).

Graphics can be overlapped so there's different possibilities to explore.
Most of the stuff you see done in Flash can be done in RunRev with graphics.

> Can I call a function in an external library from rev.
> e.g. from a windows DLL? If so, how would I do this exactly?

This would just like calling another handler or function. But you can't
really call any DLL like user32.dll and get some info from NT. You need to
write an external to do that and that's more complicated. There's an
external sdk but dont know where it's sitting... ftp.runrev.com for digs...
Eventually the runrev website but I doubt it. 

> Can I create and use lists (unkeyed arrays) in rev?
> 
> I believe that compiled rev. applications are using a runtime 
> engine - what is the performance of this approach compared to 
> C (at the fast end) or Java (at the slow end)? Are some rev. 
> features slow compared to others? How should I use program in 
> rev. to get the best performance?
 
Speed is very acceptable. If not, you can write your own C externals to
speed things up. 80 to 90% of uses are speed optimizeable.

> I also have a comment or two ...
> 
> The lack of a decent manual makes it hard to assess how 
> useful rev is for applications that are more than just a GUI 
> with some scripting in the background. The help information 
> and documentation seems fairly comprehensive but rather 
> spread around, making it hard to find stuff unless you 
> already know the name of the keyword or function you're 
> looking for. Is there anywhere on the web where I could find 
> a conceptual overview of the Transcript programming language?

Try the Dan Schaffer book or find an old HyperCard book (by Dan preferably).
they have a very nice gradual learning curve approach and get you down to
business. Otherwise, 2 weeks playing should get you far ahead just playing
with controls...

There's many other websites with help - google it or check out the many
revlinks on runrev.com. 

> Revolution is potentially very interesting, but I am really 
> having a hard time figuring out whether it can really do what 
> I want it to do, so that I could stump up the cash for it 
> with confidence. If it's really just a GUI builder, I cannot 
> tell how easy it would be to combine it with other libraries 
> to do the beind the scenes computation - or maybe rev. can do 
> that for me as well - are there any examples of more 
> elaborate applications out there that could shed some light 
> on Revolution's abilities as a general development platform?

There's many 3D and graphing examples, math stacks out there. Im working on
some myself when I get some ideas... I haven't found many limits in RunRev
that I can't code without using externals. As far as language it is awesome
and easy to maintain. GUIS are the easiest to build by far. Code is quite
fast for most uses and there's externals for the extra crunch. The rest is
getting used to it by trying!

Cheers
X

> Sorry it's a bit long - lots to ask!
> 
> Best
> 
> Gordon
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
> 



More information about the use-livecode mailing list