Welcome, Guest. Please login or register.

Author Topic: All you want to know about taglists  (Read 3390 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline krashanTopic starter

  • Full Member
  • ***
  • Join Date: Jan 2003
  • Posts: 247
  • Country: pl
  • Thanked: 1 times
  • Gender: Male
  • Hardware designer and programmer
    • Show only replies by krashan
    • Personal homepage
All you want to know about taglists
« on: October 26, 2011, 08:04:34 PM »
In the series about MorphOS basics in the MorphZone Library, I've written an extensive article about taglists, one of main concepts of the AmigaOS (and its derivatives) API. Taglists were introduced in AmigaOS 2 and are present in almost unchanged form in MorphOS, AmigaOS 4 and also AROS, so it may be an interesting reading for developers working will all these systems.

Offline jj

  • Lifetime Member
  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 4051
  • Country: wales
  • Thanked: 2 times
  • Gender: Male
    • Show only replies by jj
Re: All you want to know about taglists
« Reply #1 on: October 27, 2011, 03:18:56 PM »
Interesting read.  Is the main advantage of tag lists that their are functions for dealing with them as opposed to a normal array of key values ?
“We don't stop playing because we grow old; we grow old because we stop playing.” - George Bernard Shaw

Xbox Live: S0ulA55a551n2
 
Registered MorphsOS 3.13 user on Powerbook G4 15"
 

Offline ChaosLord

  • Hero Member
  • *****
  • Join Date: Nov 2003
  • Posts: 2608
    • Show only replies by ChaosLord
    • http://totalchaoseng.dbv.pl/news.php
Re: All you want to know about taglists
« Reply #2 on: October 27, 2011, 04:25:37 PM »
Very nice article!  Krashan FTW!
Wanna try a wonderfull strategy game with lots of handdrawn anims,
Magic Spells and Monsters, Incredible playability and lastability,
English speech, etc. Total Chaos AGA
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show only replies by Piru
    • http://www.iki.fi/sintonen/
Re: All you want to know about taglists
« Reply #3 on: October 27, 2011, 07:44:18 PM »
Quote from: JJ;665341
Interesting read.  Is the main advantage of tag lists that their are functions for dealing with them as opposed to a normal array of key values ?

The most benefit comes when tag lists are used to pass arguments to API functions: It's easy to add new functionality or parameters to existing functions, without breaking backward compatibility. Even if a newer implementation knows about new tags it doesn't interfere with old apps calling the function and only using the older tags.
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show only replies by Karlos
Re: All you want to know about taglists
« Reply #4 on: October 27, 2011, 11:36:57 PM »
Quote from: Piru;665372
The most benefit comes when tag lists are used to pass arguments to API functions: It's easy to add new functionality or parameters to existing functions, without breaking backward compatibility. Even if a newer implementation knows about new tags it doesn't interfere with old apps calling the function and only using the older tags.

Also, there are probably performance benefits over... well, what other semantics could you use? Variadic function calls are one possibility in C at least. Considering that the TagItem array can be constructed in a number of ways and can be allocated in more than one storage type (ie, not just "on the stack"), then passing a struct TagItem * pointer to your function beats pushing a long list of temporary variables onto the stack that are then popped off again - especially if the function being called makes calls to other functions internally that might use the same TagItem set (or at least deals with a subset of them).

Having said that, in a lot of use cases, the TagItem array will only be a small collection and allocated on the stack regardless.
int p; // A
 

Offline jj

  • Lifetime Member
  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 4051
  • Country: wales
  • Thanked: 2 times
  • Gender: Male
    • Show only replies by jj
Re: All you want to know about taglists
« Reply #5 on: October 28, 2011, 11:22:39 AM »
Thanks for the replies all
“We don't stop playing because we grow old; we grow old because we stop playing.” - George Bernard Shaw

Xbox Live: S0ulA55a551n2
 
Registered MorphsOS 3.13 user on Powerbook G4 15"