Eur Wrote: > > 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. The use of delay_any_mc could be differrent. But you know for sure is that co2_t6603 is not used by serial hardware. Don't get me wrong: I appreciate this kind of programming discipline and know it help if you apply it in all circumstances.
Seb wrote: > As in OOP, every lib has to take their responsability, but no more. It's quite abstact, but I think I agree. - if a lib requires an other lib, it should include it (like pwm_common). - if a lib does not use a lib, it should not include it (obvious but true, not?) - if a lib requires a certain functionality which could be provided by different libs (now or in the future), they should be at the main level. The last one leaves space for interpretation. Not in case of serial_hardware et al. But in case of delay_any_mc (I do hate that name, though, since 'mc' is outdated and it referes to a previous, limited library - maybe we should rename it to delay.jal). I can think of a situation where somebody concludes that this lib is not good enough and designs a better one and also extends it a bit. In that case, including the delay_any_mc in a lib blocks the use of this new lib. Being more practical, I'd say we go for *practical* use from *most* of the users and include delay_any_mc when you need it. And when a new one is created, it can replace the existing one. > 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, ...). I don't get the point. If it is important, retry ;-) > 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. Still don't get this, but I am not in favor of 'filling the matrix' - creating a file for every possible combination - in the jallib standard. But I can think of doing this as part of your application. Ore one could create a formmating function especially for the co2 class data (and not specific for the t6603 since the co2_t6603 should have a clean, logical interface). This would be a 'format class' library (like print and format) and have such an interface. > > 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. I agree with Seb - library interactions can be more complex. I think the issue is more that libraries should have a well-defined goal and a clean interface. This way there won't be any irrational includes. Joep --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
