torrust / bencode2json

A Bencoded to JSON converter library and console app with no intermediary in-memory structure.
https://crates.io/crates/bencode2json
GNU Lesser General Public License v3.0
1 stars 2 forks source link

Find a better name for `BencodeParser` type #12

Open josecelano opened 6 days ago

josecelano commented 6 days ago

Yesterday, I discussed the main type name with @magecnion. It might not be a good name.

Formal Definition of a Parser

A parser is a component of a computer program that takes an input string (or byte stream) and produces a structured representation, often a tree-like format, based on a formal grammar. Parsers are typically used in the context of programming languages or data formats, where they validate and transform raw input into a more structured form for further processing.

Since the library converts bencoded data directly to JSON without creating an intermediary structured representation, the term "parser" might not entirely reflect its purpose. It implies more extensive processing than what the library does.

Alternative Names (ChatGPT)

  1. BencodeConverter: Highlights the conversion process from bencode to JSON.
  2. BencodeToJson: A clear and direct name describing the functionality.
  3. BencodeTransformer: Suggests transforming the data from one format to another.
  4. BencodeSerializer: Focuses on serializing bencoded data into JSON.
  5. BencodeStreamConverter: Emphasizes that it works on streams and performs conversion.
  6. BencodeTranscoder: Suggests translating data from one encoded format to another.
  7. BencodeJsonDumper: Reflects the "dumping" nature of the process directly to JSON.
  8. BencodeInterpreter: Suggests interpreting the bencoded data directly into JSON output.
  9. BencodeDecoder: Focuses on decoding bencode and outputting JSON.
  10. BencodeEmitter: Implies emitting JSON data directly from the bencode input.

cc @da2ce7 @magecnion

josecelano commented 4 days ago

@da2ce7 suggestion:

josecelano commented 4 days ago

I like these (in this order):