fasm icon indicating copy to clipboard operation
fasm copied to clipboard

Improving naming of fasm.parser.parse_fasm_X API

Open HackerFoo opened this issue 4 years ago • 0 comments

Context from https://github.com/SymbiFlow/fasm/pull/28#discussion_r538879153:

@mithro mithro 17 hours ago Member

[optional] I wonder if these should be fasm.parser.filename and fasm.parser.string. Then maybe you can do either;

import fasm.parser fasm.parser.filename(XXXX)

or

from fasm.parser import filename as fasm_parser_filename

Currently this "stutters" a bit.

From https://blog.golang.org/package-names

Avoid stutter. Since client code uses the package name as a prefix when referring to the package contents, the names for those contents need not repeat the package name. The HTTP server provided by the http package is called Server, not HTTPServer. Client code refers to this type as http.Server, so there is no ambiguity.

See also https://michaelwhatcott.com/go-code-that-stutters/ and rust-lang/api-guidelines#66 @HackerFoo HackerFoo 17 hours ago Author Member

I like fasm.parse.from_X, but it can make things like parse.available and parse.implementation slightly awkward.

fasm.parser.from_X isn't bad. @HackerFoo HackerFoo 14 hours ago Author Member

I'm going to keep the same names for now to make it clear that they are replacements for the old code. @mithro mithro 2 hours ago Member

Please create a follow up GitHub issue to track cleaning up these names then.

HackerFoo avatar Dec 09 '20 16:12 HackerFoo