uhm... one of this questions that newbies usually ask, I need your subjectivity.
PortHardwareDevices have a basePort. All I/O is indexes through this port, i.e.
PortHardwareDeivce>>byteAt: portNumber ^ self primInPortByte: basePort+portNumber
(where portNumber should actually by portOffset or something).
Anyway, from this implementation we can see that PortHardwareDevices have a 0-based semantic for accessing the ports. This is what common literature uses (register 0, register 1, for example), and what every other software out there uses to (C based or asm based mostly).
Now, we all know that indexable objects in Smalltalk have a 1-based semantic.
so, the obvious question for the incredulous reader is: should we have 0-based or 1-based semantic for the PortHardwareDevices?
0 based will be "mathematically correct"(?), will be ok according to standard literature and other implementations.
1 based will be Smalltalkish... and I guess we could get used to it (but I'm sure will introduce more bugs when copying from documentation or other code to Smalltalk)
so? ah! got you! :-) I don't really want a debate, but some opinions will be nice
gera
gera
Gera,
Wow good question/topic and one of those things where five years from now we'll look back and say "why-the-heck did Gera choose that!!?!?!" ;)
I say 1-based semantic is the way to go as I am imagining of some "dreamy & distant" point in the future the typical user would spend their whole life within the Squeak world whereas what is used by other platforms would be irrelevant. I know, it's a dream but a good one.
Of course I totally agree that 1-based increases the risk of errors in porting code and docs from other languages but it could be really messy 5 years from now where anything hardware/device/driver related is 0-based and the rest of Squeak is 1-based.
Johnathon
----- Original Message ----- From: "Gerardo Richarte" gera@corest.com To: squeaknos@lists.squeakfoundation.org Sent: Thursday, July 13, 2006 1:36 PM Subject: [SqNOS] Question for all
uhm... one of this questions that newbies usually ask, I need your subjectivity.
PortHardwareDevices have a basePort. All I/O is indexes through this port, i.e.
PortHardwareDeivce>>byteAt: portNumber ^ self primInPortByte: basePort+portNumber
(where portNumber should actually by portOffset or something).
Anyway, from this implementation we can see that PortHardwareDevices have a 0-based semantic for accessing the ports. This is what common literature uses (register 0, register 1, for example), and what every other software out there uses to (C based or asm based mostly).
Now, we all know that indexable objects in Smalltalk have a 1-based semantic.
so, the obvious question for the incredulous reader is: should we have 0-based or 1-based semantic for the PortHardwareDevices?
0 based will be "mathematically correct"(?), will be ok according to standard literature and other implementations.
1 based will be Smalltalkish... and I guess we could get used to it (but I'm sure will introduce more bugs when copying from documentation or other code to Smalltalk)
so? ah! got you! :-) I don't really want a debate, but some opinions will be nice
gera
gera _______________________________________________ SqueakNOS mailing list SqueakNOS@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/squeaknos
squeaknos@lists.squeakfoundation.org