On 21/05/2017 12:06, Chris Angelico wrote:
On Sun, May 21, 2017 at 8:23 PM, bartc <b...@freeuk.com> wrote:

(If you imagine a future where the number of targets has increased a
hundred-fold (or we colonise the galaxy and there are a million possible
targets), then it might become clearer that the approach used here - putting
files for every conceivable machine in the same place - is not scalable.)

Actually it's not scalable as soon as you have TWO targets. Every
change has to be made to both source files. And where they differ, you
need markers to say that it's different. You know, like ifdef lines
usually are. I wonder if maybe the current system isn't the result of
incompetence after all?

Let's say we have a very simple OS that just does this:

 beep(1000,100)       # pitch, duration

and stops. So the above is the entire source. It runs on disparate machines A and B. Each of those needs to provide an implementation of beep():

def beep(p,d):       # machine A
    out(0x100, p)
    out(0x101, d)    # or whatever

def beep(p,d):       # machine B
    callint(0x30, p,d)

Now I want to port it to a new machine, and need to provide a custom version of beep() that works here:

def beep(p,d):
    print("beeeep!")

Explain why ALL these drivers, including the one I've just created, need to be part of the common source code for the OS.

Or why a change in the source code of the OS, eg. changing it to:
   beep(500, 50)
   beep(2000,200)

Needs to be done in three different places.

--
Bartc

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to