intfiction.org

The Interactive Fiction Community Forum
It is currently Tue May 21, 2013 6:47 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 17 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Sun Jun 05, 2011 3:24 pm 
Offline

Joined: Thu Jan 28, 2010 3:57 am
Posts: 136
Jim Aikin wrote:
It's still a bit more fussy for the author to set up than in I7


Yes, but you can abbreviate it by defining a template:
Code:
Test template 'testName' [testList];


Then you can define your individual test scripts simply as:
Code:
Test 'foo' ['x me', 'i', 'jump'];
Test 'bar' ['pray', 'jump'];


Which is pretty much as brief at I7.

-- Eric


Top
 Profile Send private message  
 
PostPosted: Sun Jun 05, 2011 5:53 pm 
Offline

Joined: Sun Mar 01, 2009 8:02 pm
Posts: 902
Good suggestion! The one limitation, based on my attempts to use the template, is that the template can't be defined in the tests.t extension file itself. A template, it appears, has to be defined in an .h file that is #included -- or else in the same file where the template structure is being used.

This is not a terribly difficult thing for the author to manage, it's just something to point out in the comments in the extension, if you decide to make it publicly available.


Top
 Profile Send private message  
 
PostPosted: Mon Jun 06, 2011 12:17 am 
Offline

Joined: Tue Apr 27, 2010 1:02 pm
Posts: 797
The inability to provide new templates as part of an extension is one of the few gripes I have with T3. You can work around it if your new classes inherit from existing ones, but that only takes you so far.

I have a couple custom ShuffledList types that bring TADS up to par with Inform 7 - one that provides an equivalent to "as decreasingly likely outcomes" and one that lets you randomize bits of otherwise static ShuffledList items, in approximately the same way as bracketed text and a "To say" rule.

Nothing terribly impressive but perhaps useful to others who cross over from I7. Trouble is they are awkward to use relative to their stock adv3 counterparts without template support. (I don't think I've ever defined a ShuffledList or ShuffledEventList directly, and can't imagine why anyone would want to.)


Top
 Profile Send private message  
 
PostPosted: Mon Jun 06, 2011 9:25 am 
Offline
User avatar

Joined: Tue Apr 20, 2010 2:48 pm
Posts: 687
I thought templates were a core language feature, not tied to any kind of class or object and that you can write new templates with no restrictions.


Top
 Profile Send private message  
 
PostPosted: Mon Jun 06, 2011 10:02 am 
Offline

Joined: Tue Apr 27, 2010 1:02 pm
Posts: 797
You're right that templates can be freely defined. They just can't be bundled up with an extension, since they need to be defined in the source file where they are ultimately used - either directly in that file or in a header that the file includes.

It's not the end of the world, but it does add some busywork for authors.


Top
 Profile Send private message  
 
PostPosted: Mon Jun 06, 2011 11:15 am 
Offline

Joined: Sun Mar 01, 2009 8:02 pm
Posts: 902
bcressey wrote:
It's not the end of the world, but it does add some busywork for authors.

If you're going to use your new template in many source files, you could always hack adv3.h. That's what I'd do.


Top
 Profile Send private message  
 
PostPosted: Mon Jun 06, 2011 11:18 am 
Offline
User avatar

Joined: Tue Apr 20, 2010 2:48 pm
Posts: 687
#including everything you need in your source files is something most programmers find intuitive though. Given that T3 is modeled somewhat after C++, I think having a header file for the extension would seem natural. Only non-programmers would find it a strange requirement. After all, you *are* programming when using T3. Also, having a header file gives you the ability to provide macros to the extension user, which gives you the ability to provide short syntax for otherwise multi-line code. Headers are a nice feature, not something to get annoyed about :)

Or we could file a new wish at the T3 tracker for templates to be exported.


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page Previous  1, 2

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group