Best,
Mich
Michiel Spapé
Research Fellow
Perception & Action group
University of Nottingham
School of Psychology
--
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-p...@googlegroups.com.
To unsubscribe from this group, send email to e-prime+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/e-prime?hl=en.
This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.
This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.
Just on that point, context attributes are not variants, they are
always just ordinary strings. But do not take my word for that, if
you run the following code in any inline,
c.SetAttrib "MyAttrib", 0
MsgBox TypeName( c.GetAttrib("MyAttrib") )
the message box will indicate that MyAttrib has the type "String", no
matter what you put in for the value of the attribute.
That said, Visual Basic (and hence E-Basic) will attempt to cast the
attribute to an appropriate type as it gets used. E.g., both
c.SetAttrib "MyAttrib", 1
MsgBox 2 + TypeName( c.GetAttrib("MyAttrib") )
and
c.SetAttrib "MyAttrib", 1
MsgBox TypeName( c.GetAttrib("MyAttrib") ) + 2
produce the numeric result 3, whereas
c.SetAttrib "MyAttrib", 1
MsgBox "2" + TypeName( c.GetAttrib("MyAttrib") )
produces the string "21", and
c.SetAttrib "MyAttrib", 1
MsgBox TypeName( c.GetAttrib("MyAttrib") ) + 2
produces the string "12".
So it is a safer practice to always explicitly cast attributes to the
desired type, e.g.
iValue = CInt( c.GetAttrib("MyAttrib") )
-- dkm
Michiel Spapé
Research Fellow
Perception & Action group
University of Nottingham
School of Psychology
and
-- dkm
--