coding style rationale

2006-06-07 Thread Massimo Manghi

Hi riveters

I was looking at the DIO and SESSION packages code more
closely than I did before and found out that there are
some methods in dio.tcl where Tcl keywords like 'list'
and 'array' are  replaced and reused as names for
simbolic entities like a specific list or array.

Reading such code is puzzling but I'm unwilling to
think that the fellows who wrote it did it without a
good and specific reason. Just out of curiosity
someone would explain why it was done this way?

thank you

--
-- Massimo Manghi 


-- Dipartimento di Biologia Evolutiva e Funzionale
-- Università degli Studi di Parma
-- Parco Area delle Scienze 11A - 43100 Parma


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: coding style rationale

2006-06-07 Thread Damon Courtney
   Do you mean the 'list' and 'array' methods?  They were named that 
way for two reasons.  One, to jive with what ns_tcl was already doing, 
and two to jive with what they do and what  Tcl'er would expect them to 
do based on name.


   There was no scientific (or even good) reason other than that. 0-]

Damon


Massimo Manghi wrote:

Hi riveters

I was looking at the DIO and SESSION packages code more
closely than I did before and found out that there are
some methods in dio.tcl where Tcl keywords like 'list'
and 'array' are  replaced and reused as names for
simbolic entities like a specific list or array.

Reading such code is puzzling but I'm unwilling to
think that the fellows who wrote it did it without a
good and specific reason. Just out of curiosity
someone would explain why it was done this way?

thank you




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: coding style rationale

2006-06-07 Thread Massimo Manghi

Damon Courtney wrote:

   Do you mean the 'list' and 'array' methods?  They were named that 
way for two reasons.  One, to jive with what ns_tcl was already doing, 
and two to jive with what they do and what  Tcl'er would expect them 
to do based on name.




   There was no scientific (or even good) reason other than that. 0-]

Damon


I didn't mean specifically the methods, in that case it does make
sense to call them this way. It became much clearer to me since I read
the word 'jive'

look at this method from dio.tcl  (I hope I'm not messing up with the 
indentation).


protected method table_check {list {tableVar myTable} {keyVar myKeyfield}} {
   upvar 1 $tableVar $tableVar $keyVar $keyVar
   set data(-table) $table
   set data(-keyfield) $keyfield
   ::array set data $list

   if {[lempty $data(-table)]} {
   return -code error -table not specified in DIO object
   }
   if {[lempty $data(-keyfield)]} {
   return -code error -keyfield not specified in DIO object
   }

   set $tableVar $data(-table)
   set $keyVar   $data(-keyfield)
}

the 'list' argument is not making anything that one would
expect from the tcl command *list*, it's *a list* placed
as a first argument in the method: as I saw it it made me
think where the hell the braces are?

--
-- Massimo Manghi 


-- Dipartimento di Biologia Evolutiva e Funzionale
-- Università degli Studi di Parma
-- Parco Area delle Scienze 11A - 43100 Parma


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]