Re: [riot-devel] API proficiency levels
Hi, On 05/22/15 15:44, Joakim Gebart wrote: > I like the idea of getting rid of some redundant input validation. For > example, if you are internally using spi_transfer_byte to provide > spi_transfer_regs, then if the SPI device is valid for the first byte > transferred, then it is probably going to be valid for the rest of the > bytes in the same function call chain. I propose that a device is checked once for validity when calling the init_function, and then not anymore... Kaspar ___ devel mailing list devel@riot-os.org https://lists.riot-os.org/mailman/listinfo/devel
Re: [riot-devel] API proficiency levels
Did the discussion about redundant parameter validations and DEVELHELP die? I like the idea of getting rid of some redundant input validation. For example, if you are internally using spi_transfer_byte to provide spi_transfer_regs, then if the SPI device is valid for the first byte transferred, then it is probably going to be valid for the rest of the bytes in the same function call chain. There was some discussion about null pointer checks in a PR or a mailing list thread but I did not find it when I did a brief search. Best regards, Joakim Gebart www.eistec.se On Wed, Mar 25, 2015 at 5:02 PM, Kaspar Schleiser wrote: > Hey, > > On 03/25/2015 11:12 AM, Hauke Petersen wrote: >> >> in general I like the idea, one problem I see is however, that is not >> always clear, to which level an API belongs (e.g. the GPIO API is >> definitely used also by high-level application programmers, while still >> belonging to the low-level peripheral drivers...). > > We could mark certain functions / parts of an API as "advanced" in the docs > and provide "safe" alternatives. > > Seriously, it hurts to not be able to work around 10 redundant > checks whether an int coming from flash is a correct SPI device... > > > Kaspar > ___ > devel mailing list > devel@riot-os.org > https://lists.riot-os.org/mailman/listinfo/devel ___ devel mailing list devel@riot-os.org https://lists.riot-os.org/mailman/listinfo/devel
Re: [riot-devel] API proficiency levels
Hey, On 03/25/2015 11:12 AM, Hauke Petersen wrote: in general I like the idea, one problem I see is however, that is not always clear, to which level an API belongs (e.g. the GPIO API is definitely used also by high-level application programmers, while still belonging to the low-level peripheral drivers...). We could mark certain functions / parts of an API as "advanced" in the docs and provide "safe" alternatives. Seriously, it hurts to not be able to work around 10 redundant checks whether an int coming from flash is a correct SPI device... Kaspar ___ devel mailing list devel@riot-os.org https://lists.riot-os.org/mailman/listinfo/devel
Re: [riot-devel] API proficiency levels
Hi Kaspar, in general I like the idea, one problem I see is however, that is not always clear, to which level an API belongs (e.g. the GPIO API is definitely used also by high-level application programmers, while still belonging to the low-level peripheral drivers...). Cheers, Hauke On 25.03.2015 10:39, Kaspar Schleiser wrote: Hey guys, I've been thinking about how to find generally usable principles for certain API aspects, like when to check a function's parameters for validity. An idea came to mind: We could define some (two, three) levels of how low an API goes and define (and document) consistent behaviour around those levels. For example, a high-level timer or socket API that is being used by any simple application has probably more need for parameter checking than a low-level interface that no normal user will ever see. On the other hand, low-level functions for accessing the flash will probably abstracted with a sane user API. The idea is to document that some API's do need a deep understanding of what's going on, thus will be used by developers that don't need a high level of safeguards. We could omit a lot of extra sanity checks. Other API's will be used by high-level programmers which might not know how to debug parameter mistakes, so checking function arguments is more important. What do you think? Kaspar ___ devel mailing list devel@riot-os.org https://lists.riot-os.org/mailman/listinfo/devel ___ devel mailing list devel@riot-os.org https://lists.riot-os.org/mailman/listinfo/devel
[riot-devel] API proficiency levels
Hey guys, I've been thinking about how to find generally usable principles for certain API aspects, like when to check a function's parameters for validity. An idea came to mind: We could define some (two, three) levels of how low an API goes and define (and document) consistent behaviour around those levels. For example, a high-level timer or socket API that is being used by any simple application has probably more need for parameter checking than a low-level interface that no normal user will ever see. On the other hand, low-level functions for accessing the flash will probably abstracted with a sane user API. The idea is to document that some API's do need a deep understanding of what's going on, thus will be used by developers that don't need a high level of safeguards. We could omit a lot of extra sanity checks. Other API's will be used by high-level programmers which might not know how to debug parameter mistakes, so checking function arguments is more important. What do you think? Kaspar ___ devel mailing list devel@riot-os.org https://lists.riot-os.org/mailman/listinfo/devel