ethereum / sharding

Sharding manager contract, and related software and tests
480 stars 105 forks source link

Minor edits, ref for state size #41

Closed jamesray1 closed 6 years ago

hwwhww commented 6 years ago

I'd say in this document, Vitalik uses Pythonic specification / pseudo code mostly (except description of contracts, they are in solidity style). So I don't like the idea of replacing shard_id with shard_ID.

jamesray1 commented 6 years ago

PEP 008 uses all caps for acronyms.

Note: When using abbreviations in CapWords, capitalize all the letters of the abbreviation. Thus HTTPServerError is better than HttpServerError.

mhchia commented 6 years ago

@jamesray1 I think it depends on whether id is an abbreviation or acronym? IMO it's an abbreviation of "identifier".

hwwhww commented 6 years ago

You gave an example of CapWords, which using abbreviations in CapWords. And I think this variable is more like lower_case_with_underscores?

I still feel uncomfortable with shard_ID 🤔

  1. There's the built-in function id().
  2. If we consider id as an abbreviation, we can see this style in Python and PEP8 example everywhere, e.g., http://legacy.python.org/dev/peps/pep-0008/#code-lay-out uses var_ in this case).
jamesray1 commented 6 years ago

@hwwhww It doesn't matter whether the format is CapWords or in word1_word2 format. The point is that if an acronym occurs such as HTTP (HTTP is an acronym, not an abbreviation, I will submit a PR to PEP008 for that), you capitalize all the letters. The link that you gave has numbers as words after var_, e.g. var_one, var_two, etc., not abbreviations or acronyms, so your example doesn't seem to be relevant. As a native English speaker, I can vouch that ID is written as ID, not as id. Id means something entirely different and is pronounced as one syllable (it rhymes with bid), whereas ID is pronounced by reading out the letters (I dee). This page distinguishes between ID and id.

"Definition of id

: the one of the three divisions of the psyche in psychoanalytic theory that is completely unconscious and is the source of psychic energy derived from instinctual needs and drives — compare ego, superego"

"In Latin, id means simply "it". Sigmund Freud (and his translator) brought the word into the modern vocabulary as the name of what Freud believed to be one of the three basic elements of the human personality, the other two being the ego and the superego. According to Freud, the id is the first of these to develop, and is the home of the body's basic instincts, particularly those involving sex and aggression. Since the id lacks logic, reason, or even organization, it can contain conflicting impulses. Primitive in nature, it wants to be satisfied immediately. Although its workings are completely unconscious, Freud believed that its contents could be revealed in works of art, in slips of the tongue ("Freudian slips"), and in one's dreams."

screenshot from 2017-12-20 01-50-24

Furthermore:

http://www.dictionary.com/browse/id

"a means of identification, as a card or bracelet containing official or approved identification information."

Note that it doesn't need to be a card or bracelet, just some means of identification, e.g. an address on a blockchain.

https://en.oxforddictionaries.com/definition/id

I don't like to be pedantic, but I'm just pointing out how documents can be written better, which will be less distracting for readers so that they can then more easily understand the intended meaning.

ChihChengLiang commented 6 years ago

@jamesray1 Nice explanation on ID. But would like to offer a piece of information to support @mhchia 's argument that ID is an abbreviation of "identifier". In the context of sharding, would the term "ID" be mentioned in the sense of Universally Unique Identifier (UUID), a value generated in accordance with some specifications to provide unique values between systems and over time, instead of as if shards bringing a card or bracelet?

jamesray1 commented 6 years ago

@ChihChengLiang, as I said, "Note that it doesn't need to be a card or bracelet, just some means of identification, e.g. an address on a blockchain." The shard_ID is still a way of identifying shards; it is more appropriate to use shard_ID rather than shard_id. If it is a UUID, then an ID would be an abbreviation of UUID, so that supports using shard_ID. ID in ID card or ID bracelet is not an acronym, it is an abbreviation of identification or identity. Similarly identifier is more appropriately abbreviated as ID. Abbreviating it as id is unconventional and looks the same as the id in Freudian psychology. If you want to distinguish it from ID you could use UUID, but then that's just more typing.

hwwhww commented 6 years ago

@jamesray1 Hi! Thank you for providing the reference. Learning from you! :blush:

It doesn’t matter whether the format is CapWords or in word1_word2 format. The point is that if an acronym occurs such as HTTP (HTTP is an acronym, not an abbreviation, I will submit a PR to PEP008 for that), you capitalize all the letters.

But I don’t see "doesn’t matter whether the format is CapWords or in word1_word2 format" in PEP8, the note is only for CapWords. My previous example may be not suitable for what I wanted to say. My point is we are using lower_case_with_underscores for naming variable. This answer and his example in Stack Overflow is in line with what I want to say and my understanding of PEP8: coding style - Python: Naming with Acronyms - Stack Overflow.

jamesray1 commented 6 years ago

@hwwhww OK, fair enough. I will edit the PR.