Re: DEF-USE

Robert DiFalco ([email protected])
Fri, 2 Jun 1995 12:06:47 -0700


Nathan,

>
>USE {name "url"} BOB
>

Is something like this currently illegal? Looking at the semantic of USE,
its as though it should be able to do that. If you can't DEF a URL or a
whole file (maybe the DEF belongs at the top of the (.wrl) file instead of
before calling it. Earlier I made a suggestion to this effect, something
like this:

// File Bob.Wrl

#VRML V1.0 ascii

DEF Bob
{
.
. <Regular old world definitions here>
.
}

// EoF: Bob.Wrl

Then in another (.wrl) file....

// File UseBob.Wrl

#VRML V1.0 ascii

WWWInline
{
name "http://Boblandia/VRML/Bob.wrl"
bboxCenter 0 0 0
bboxSize 0 0 0
}

.
. <Now, further down in the *same* (UseBob.Wrl)
.

USE Bob # This should Load bob again.

// EoF: UseBob.Wrl

You could even do this:

// File UseBob2.Wrl

#VRML V1.0 ascii

USE BoxedBob
{
WWWInline
{
name "http://Boblandia/VRML/Bob.wrl"
bboxCenter 0 0 0
bboxSize 0 0 0
}
}

.
. <Now, further down in the *same* (UseBob.Wrl)
.

USE Bob # This should Load bob again.

.
. <Even further down in the *same* (UseBob.Wrl)
.

USE BoxedBob

// EoF: UseBob2.Wrl

As you can see, with a consistent and global semantic (i.e. You can use it
for anything as long as you stick to the rules of its meaning) for DEF and
USE, you can really start to do some exciting things. I guess I just assumed
you could apply its use in this way. Is that not true?

Additional, I think it would be hella usefull to be able to DEF things
without them being "used" until you actually USE them. For example, you
could have a (.wrl) file that is an archive of many different objects as is
implied by the following which assumes the existence of a keyword called
PASSIVE USE that works just like USE but in a more passive way:

// File Library.Wrl

#VRML V1.0 ascii

PASSIVE DEF Teapot
{
.
. <Definition of a Teapot>
.
}

PASSIVE DEF CoffeeTable
{
.
. <Definition of a Coffee Table>
.
}

PASSIVE DEF Desk
{
.
. <Definition of a Desk>
.
}

.
. <and so on, and so on>
.

// EoF: Library.Wrl

You could use this defintition library thusly:

// File UseLibrary.Wrl

#VRML V1.0 ascii

# Since the Inline file is full of only
# passive definitions, the following
# does not display anything to
# the screen.

WWWInline
{
name "http://Library/VRML/Library.wrl"
}

.
. <Now, further down in the *same* (Library.Wrl)
.

USE CoffeeTable # This will load the coffee table.
. # Of course, you can nest and/or
. # modify this stuff so that the
. # the teapot appears to be resting
# on the coffee table.
USE Teapot # This will Load the teapot.

// EoF: UseBob.Wrl

I think a PASSIVE DEF would be hugely usefull. Some alternative keywords
suggestions for this functionality follows:

Keywords that DEF without immeadiately loading:

NAME [Name] {...}
PASSIVE DEF [Name] {...}
LEARN [Name] AS {...}
STORE TO [Name] {...}
PREPARE [Name] {...}

Robert