> > > We have a serious miscommunication here. > At least, we agree on this :)
> I really don't why we shouldn't build libs over other libs (of course, > obviously, if it's done right). > > > There is a verb missing in this sentence, but I read it as: > > I really don't see why we should build libs over other libs (of course, > obviously, if it's done right). > > > Which is quite different to what you meant :-) > OK, I apologize for this. I keep re-read my emails before sending them, still typos, errors. What I meant was: I really don't see why we *shouldn't* build libs over other libs (of course, obviously, if it's done right). > > Let me explain my proposal: > > The old JAL included a lot, also inside the libraries. I didn't like it. > Apart from stack issues, I would like to include everything in one spot > (say, one page of source) where you can clearly see what is included and > what not. > > Example: > > include delay_any_mc > > const baudrate = 9600 > include serial_hardware > > include co2_t6603 > > var bit TC77_SIO is pin_a0 > pin_a0_direction = input > var bit TC77_SCK is pin_a1 > pin_a1_direction = output > include temperature_tc77 > > > All libs use delay_any_mc, and co2_t6603 uses serial_hardware. > > If you want to use co2_t6603 with serial_software, and it includes the > serial_hardware INSIDE the lib, you have to hack it. > That's right, that would be design. As in OOP, every lib has to take their responsability, but no more. In your case, I'd say co2_t6603 just provide a way (an interface) to the sensor. Writing results through serial should *not* by done in this lib, because it's already a special way to use this lib (ie. you may never want to display any information received from this sensor). So this should be done: either in the client code itself, either in another lib, dedicated to write results through serial, the hardware way. You guess it: for me, this is to be done in client code, in this case. Another option in this case, and maybe that's what you say about print.jal/format.jal: the lib itself could implement get/put function, expecting an output device (serial, lcd, ...). We could also create a seperate lib, like co2_t6603_print.jal, which would specifically implement these func. The separate file shows to users that this is for a "special" usage, at least this is not the core functionnality. I tend to use this type of construct quite often. I like having smaller file, with clearly defined responsability (get information from sensor, printing results) > > My proposal: libs may only use 'put and 'get functions (which are > lib-independent) to interact with other libs. > I disagree. Not only "put" and "get" can be lib-independent. Provided two libs implements the same interface, that is, defining the procedures, functions, variables, constants, they can be used indifferently (this is the purpose of LCD libs: two types of LCDs, same implementation). What you say here is related to the topic about namespaces convention. > We could make an exception for a "library family" like the PWM libs that > consist of a main lib and sublibs for every pin. > Still, this can be done without "includes", but a certain include order > would be needed, like: > > include pwm_common > include pwm_ccp1 > I don't understand your point. Could you explain where is the exception ? > > > Yes, I realise co2_t6603 does not work with put & get yet. This is only a > proposal. > Sure ! <http://groups.google.com/group/jallib?hl=en> Seb --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jallib" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/jallib?hl=en -~----------~----~----~----~------~----~------~--~---
