On Wed, Aug 16, 2023 at 6:44 PM Jon Perryman <jon.perry...@gmail.com> wrote:
> Struct does not solve the basic problem. In what way are you suggesting to > solve the described os.open() changes? Should each API be seperate from > os.open where it must be used with every read/write? > I guess I don't understand what you are proposing since the `os.open()` API cannot be changed without breaking the Go backward compatibility guarantee. If you are proposing a replacement to `os.open()` that is more flexible that has optional arguments then I would argue a struct argument is the way to go (pun intended). You seem to be arguing, imprecisely, for the Go language to support changes to a public API that allows introducing new behavior without breaking backward compatibility. Adding keyword arguments does not solve that problem and your example of extending `os.open()` is nonsensical. > On Wed, Aug 16, 2023 at 6:14 PM Kurtis Rader <kra...@skepticism.us> wrote: > >> Personally, and I say this as a happy user of Python, I dislike keyword >> parameters. Note that in Python keyword parameters are (or should be) >> seldom used for anything other than optional arguments. And if your API has >> so many parameters that they need names the API probably needs refactoring. >> Alternatively, pass a struct whose contents can be initialized using the >> struct member names. >> >> On Wed, Aug 16, 2023 at 6:04 PM Jon Perryman <jon.perry...@gmail.com> >> wrote: >> >>> Do you feel your GOLANG API implementations allows your API's >>> and functions to evolve and grow? Personally, positional args has pissed me >>> off for years when a proven simple solution has never been adopted by most >>> Unix programming languages (except Javascript). Most notably, it's missing >>> from GOLANG. >>> >>> Everyone here understands and uses os.open from the os package. For >>> argument's sake, let's say os.open() is your responsibility to integrate >>> nosql, memory files, compression, encryption, btree, key indexed files and >>> more. How do you modify os.open( ) to integrate these file related >>> features? This was solved years ago in languages not used in Unix >>> using keyword arguments that also included positional. For example: >>> >>> func os.open(name string, memoryfile= bool, compress= bool, btree{ >>> btree_optons string }, encrypt{ key= string }, nosql{ nosql_options string >>> } ) (*File, error) >>> os.open('myfile.txt', encrypt{ key='abc' }, compress=true) >>> >>> The os.open args 1, 3 and 5 would be set from the specified arguments. >>> >>> Is this something that others need and I should pursue or should I just >>> forget it? Proposal https://github.com/golang/go/issues/62078 was >>> closed with "I don't see anything concrete being proposed here.". If I >>> should pursue this, should I reword it or reduce it to this Email? >>> >>> Thanks, Jon. >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "golang-nuts" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to golang-nuts+unsubscr...@googlegroups.com. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/golang-nuts/CAByJhJnkuai27VNiE6PraU9-5hoO85Hm__0UQJrT75a7KqD8uw%40mail.gmail.com >>> <https://groups.google.com/d/msgid/golang-nuts/CAByJhJnkuai27VNiE6PraU9-5hoO85Hm__0UQJrT75a7KqD8uw%40mail.gmail.com?utm_medium=email&utm_source=footer> >>> . >>> >> >> >> -- >> Kurtis Rader >> Caretaker of the exceptional canines Junior and Hank >> > -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CABx2%3DD9hJq6QiRxXGayFM8bhbfGc%2BA-u5qmTB5YExZj_e88bMw%40mail.gmail.com.