On 9 Oct 2008, at 11:52 , Sebastien Lelong wrote:

> BTW I don't really like the prefix 'temp_', smells too much to
>>
>> 'temporary'. What about changing it to 'thermo_'?
>
> The TC77 *only* measures temperature, nothing else. Besides, the  
> "celsius" part says something about the temperature too.
>
> IIRC, even if I have sufgested to prefix with "temp_", I have to  
> admit it can be confusing... Yes, the procedure's name give clues  
> about something related to temperature, but the filename itself is  
> confusing: temp_tc77.jal...
>
>
>> The CO2 library has similar deviations from our naming conventions  
>> (no
>> CO2-prefix for global variables/constants and procedures/functions).
> I can rename them to device_function() too. Trouble is, the library  
> name is function_device.jal. As in lcd_hd444780.jal
>
> The lib (filename) is named: co2_t6603.jal. function = co2, device  
> = t6603. Following our convention, instead of having  
> "get_co2_status", you should have t6603_get_status() or  
> t6603_get_co2_status(). So when a new lib wil deal with co2, there  
> won't be any namespace collision. Except if you want to be able to  
> have a common interface, so you just have to substitute the  
> "include" statement, and all procedures/functions remain the same.
>
> Err... Isn't this complicated ? Isn't this a bad sign ?...

Yes, yes.

> Can you define a namespace for:
>
> library files
>
> function_device

so lcd_hd44780_4.jal, temperature_tc77.jal co2_t6603.jal?

> library procedures
> library variables
>
> variables and procedures follow the same rules, no distinction. For  
> both:
>
> device_whatever if you want to avoid namespace collision

so hd44780_clear(), hd4480_line1(), hd44780_line2(),  
tc77_read_celsius_sbyte(), tc77_read_raw(), t6603_read_co2_ppm(),  
t6603_set_height()?

I know someone who will not like this :-)

But it is correct. From the JSG:

> All external names (of global variables, constants, procedures and  
> functions available to application programs) must start with a  
> prefix unique to the library. For example the names of the  
> procedures in the lcd-libaries start with lcd_.

If it has to be unique to the library, the device is the best option.  
Methinks that switching LCDs (say lcd_hd44780_4 and lcd_hd44780_8)  
and keeping procedure names would be a bonus, which means lcd_clear 
(), whatever LCD you are running.

Again, JSG:

> Name your pins according to the context, to what your library is  
> doing. Client code, ie. users, will have to define those variables  
> before actually include your great library.

I like to name the pins as they connect to the external part, like:

HD44780_EN, HD44780_RS, HD44780_DATA, TC77_SIO, TC77_SCK, T77_CS,  
T6603_RX, T6603_CX.

The last two don't need names, since it uses the serial pins.


> These are defined in Rob's device file use guide, right ?

And where can I read that?


More talk about these namespaces is needed.

Joep, throw in you $0.02

---
ir EE van Andel [EMAIL PROTECTED]  http://www.fiwihex.nl
Fiwihex B.V. Wierdensestraat 74, NL7604BK Almelo, Netherlands
tel+31-546-491106 fax+31-546-491107



--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to