avatarJohn Worthington

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

3786

Abstract

arison operators, and bitwise operators on this type too.</p><p id="c4da">It’s important to note that there is another type, called <code>bytes</code> which is different from the above in that it is a dynamically sized array, and not a value type but a reference type. It is basically shorthand for <code>byte[]</code>.</p><p id="ad39">When you can limit the length of your data to a predefined amount of bytes, it is always good practice to use some of <code>bytes1</code> to <code>bytes32</code> because it is much cheaper.</p><h2 id="0118">Enums</h2><p id="aea7"><b>Enums</b> in Solidity are a way to create user-defined types. Enums are explicitly convertible to integer types, but not implicitly. Enum values are numbered in the order they are defined, starting from 0.</p><p id="ed00">Enums are not part of the ABI (Application Binary Interface — more on this in a later lesson, but it’s basically how you encode Solidity code for the Ethereum Virtual Machine, and how you get data back). This means that if your function returns an <code>enum</code> for example, it will be automatically converted to a <code>uint8</code> behind the scenes. The integer returned is just large enough to hold all enum values. With more values, the size gets increased too (<code>uint16</code> and up).</p><p id="cdb6">The below code, taken from the <a href="https://docs.soliditylang.org/en/v0.4.24/index.html">Solidity docs</a>, defines an enum with four possible values, creates a variable of that enum named <code>choice</code> and a constant called <code>defaultChoice</code>that will hold a default value.</p><div id="cf29"><pre><span class="hljs-keyword">enum</span> <span class="hljs-title class_">ActionChoices</span> { GoLeft, GoRight, GoStraight, SitStill } ActionChoices choice; ActionChoices <span class="hljs-type">constant</span> <span class="hljs-variable">defaultChoice</span> <span class="hljs-operator">=</span> ActionChoices.GoStraight;</pre></div><p id="66a9">Now we can define some functions to interact with our <code>enum</code>.</p><div id="c0bb"><pre><span class="hljs-title function_"><span class="hljs-keyword">function</span> <span class="hljs-title">setGoStraight</span></span>() <span class="hljs-keyword">public</span> { choice = ActionChoices.GoStraight; }

<span class="hljs-title function_"><span class="hljs-keyword">function</span> <span class="hljs-title">setChoice</span></span>(ActionChoices <span class="hljs-keyword">new</span><span class="hljs-type">Choice</span>) <span class="hljs-keyword">public</span> { choice = <span class="hljs-keyword">new</span><span class="hljs-type">Choice</span>; }</pre></div><p id="6bc2">The first one simply sets the <code>choice</code> to <code>GoStraight</code> while the second one sets it to the choice that the caller passes into the function. As we can see after deployment, the <code>setChoice</code> function expects a <code>uint8</code> value, which corresponds to the <code>enum</code> value declared at that number.</p><figure id="e997"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*1pKNPVy4UUBCSLi2-SIckg.png"><figcaption>Testing enums in Remix</figcaption></figure><p id="7917">If we want to get the value of <code>choice</code> and <code>defaultChoice</code>, we can define the following functions:</p><div id="1f02"><pre><span class="hljs-keyword">function</span> <span class="hljs-title">getChoice</span>() public view returns (ActionChoices) { <span class="hljs-keyword">return</span> <span class="hljs-type">choice</span>; }</pre></div><div id="43e7"><pre><span class="hljs-function">function <span class="hljs-title">getDefaultChoice</span>() <span class="hljs-keyword">public</span> pure <span class="hljs-title">returns</span> (<span class="hljs-params"><span class=

Options

"hljs-built_in">uint</span></span>)</span> { <span class="hljs-keyword">return</span> <span class="hljs-built_in">uint</span>(defaultChoice); }</pre></div><p id="c2f2">As we can see if we try this out in Remix, the first function returns a <code>uint8</code> while the second returns a <code>uint256</code>.</p><figure id="e514"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*jmaOFb9GhXz7FWC4ONMa_A.png"><figcaption>Testing enums in Remix</figcaption></figure><h2 id="3c7c">Fixed point numbers</h2><p id="2ecc"><b>Fixed point numbers </b>represent fractional numbers by storing a fixed number of digits of their fractional part. No matter how large or small the fractional part is, it will always use the same number of bits.</p><p id="cdcd" type="7">Fixed point numbers are not fully supported by Solidity yet. They can be declared, but cannot be assigned to or from.</p><p id="f872">We can differentiate between signed fixed point numbers, declared with the <code>fixed</code> keyword, and unsigned fixed point numbers, declared with the <code>ufixed</code> keyword.</p><p id="3c1c">It can also be declared as <code>fixedMxN</code> or <code>ufixedMxN</code> where <code>M</code> represents the number of bits the type takes, and <code>N</code> represents the number of decimal points. <code>M</code> has to be divisible by 8 and a number between 8 and 256. <code>N</code> has to be a number between 0 and 80.</p><p id="96e1">They function with the following operators:</p><ul><li>Comparisons: <code><=</code>, <code><</code>, <code>==</code>, <code>!=</code>, <code>>=</code>, <code>></code> (evaluate to <code>bool</code>)</li><li>Arithmetic operators: <code>+</code>, <code>-</code>, unary <code>-</code>, unary <code>+</code>, <code>*</code>, <code>/</code>, <code>%</code> (remainder)</li></ul><h2 id="09b7">Conclusion</h2><p id="bd3a">In this lesson, we looked at what value types are available in Solidity and how each one works.</p><p id="28de">Thank you for staying with us till the end. If you enjoyed reading this piece please keep in touch and follow Solidify to keep up with our lessons on Solidity. In the upcoming articles, we will deep dive into the intricacies of the language, progressing from beginner to advanced level.</p><p id="067c">If you are new to Solidity, check out the previous lessons about setting up a local development environment and writing your first smart contract.</p><div id="6b76" class="link-block"> <a href="https://readmedium.com/how-to-setup-your-local-solidity-development-environment-c4c8195810f3"> <div> <div> <h2>How to Setup Your Local Solidity Development Environment</h2> <div><h3>Get started with smart contract development</h3></div> <div><p>medium.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*HHko-o9m1sVngmTeRVYgKA.jpeg)"></div> </div> </div> </a> </div><div id="3ad1" class="link-block"> <a href="https://readmedium.com/lesson-1-your-first-solidity-smart-contract-1ba7e641f9a3"> <div> <div> <h2>Lesson 1: Your First Solidity Smart Contract</h2> <div><h3>In the previous lesson, we looked at how to set up your local Solidity development environment. Here we will continue…</h3></div> <div><p>medium.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*7r7HSYkbn73NrmR_skvh5w.jpeg)"></div> </div> </div> </a> </div></article></body>

Is a Statement True?

The Reasons To Consider Context Before Answering That Question

AI-generated image created with Midjourney 5

Un­der­stand­ing con­text is es­sen­tial to un­der­stand­ing the truth concerning any issue. Con­text refers to the circum­stances, con­di­tions and en­vi­ron­ment in which some­thing ex­ists or oc­curs. It is the back­ground against which some­thing is ex­pe­ri­enced or in­ter­pret­ed. With­out con­text, it is im­pos­si­ble to ful­ly com­pre­hend the mean­ing of any state­ment, ac­tion or event. It is often the case then, in order to grasp the circumstances of an event, we may be required to suspend belief. Or at least the belief we hold about how we arrived at a conclusion.

Con­text pro­vides the frame­work for in­ter­pre­ta­tion. The mean­ing of a statement or ac­tion can vary de­pend­ing on the con­text in which it is made. For ex­am­ple, the state­ment “I hate you” can be in­ter­pret­ed dif­fer­ent­ly de­pend­ing on the con­text. If it is said in the heat of an ar­gu­ment, it may be a tem­po­rary ex­pres­sion of anger. How­ev­er, if it is said re­peat­ed­ly over a long pe­ri­od, it may in­di­cate a deep-seat­ed re­sent­ment. With­out un­der­stand­ing the con­text in which the state­ment is made, it is im­pos­si­ble to de­ter­mine its true mean­ing.

The in­ter­pre­ta­tion of his­tor­i­cal events de­pends on the con­text in which those events oc­curred. For ex­am­ple, the Amer­i­can Rev­o­lu­tion can be seen as a heroic strug­gle for free­dom or as a vi­o­lent re­bel­lion against le­git­i­mate au­thor­i­ty. The inter­pre­ta­tion of the event also de­pends on the con­text in which it is viewed. Un­der­standing the po­lit­i­cal, so­cial and eco­nom­ic con­di­tions of the time is nec­es­sary to un­derstand the mo­ti­va­tions and ac­tions of the peo­ple in­volved.

We can see this same need for context to understand the people who were involved with January 6. Without understanding how confusing it had to have been for them to be wrong about what should have been right is truly disconcerting. But the context of what they had heard was being hidden from them by the very man they thought they had to protect. To look further into the context of what took place before and after that day we have to also have the context of how callously their Master has treated them since. He kind of hung them out to dry. That one contextual fact shines a telling light on the folly those poor folks were sold.

The con­text in which an event takes place pro­vides a ba­sis for com­par­i­son to and with other events. For example, to de­ter­mine the truth of a state­ment, it is of­ten nec­es­sary to com­pare it to oth­er state­ments or facts. How­ev­er, with­out con­text, it is im­pos­si­ble to make mean­ing­ful com­par­isons. For ex­am­ple, the state­ment “The earth is flat” may seem ab­surd to­day, but it was wide­ly be­lieved for cen­turies. With­out un­der­stand­ing the his­tor­i­cal con­text in which the state­ment was made, it is im­pos­si­ble to ap­pre­ci­ate the sig­nif­i­cance of the state­ment. It is necessary to understand that the science of the times did not have enough information to have what we would now call sci­en­tif­ic knowl­edge.

Un­der­stand­ing the con­text of a state­ment or ac­tion is nec­es­sary to com­pare it to oth­er state­ments or ac­tions made by the same per­son or group. For ex­am­ple, a politi­cian may make a state­ment that seems con­tra­dic­to­ry to their pre­vious state­ments. How­ev­er, with­out un­der­stand­ing the con­text in which the statement was made, it is im­pos­si­ble to de­ter­mine whether it rep­re­sents a change in po­si­tion or a mis­un­der­stand­ing of the is­sue. I mean can anyone determine what Georgie Mitty means when he says anything? Can anyone determine what Kevin means when he says he sent a budget to the White House? Can anyone determine what Margie means when she speaks about anything? What is all that arrogant anger about and what is she trying to say with it? Anyone have any ideas?

Con­text pro­vides a ba­sis for eval­u­a­tion. To de­ter­mine the truth of a state­ment or ac­tion, it is of­ten nec­es­sary to eval­u­ate it against a set of cri­te­ria. Howev­er, with­out con­text, it is im­pos­si­ble to de­ter­mine the ap­pro­pri­ate cri­te­ria for evalu­a­tion. For ex­am­ple, the state­ment “I am a good per­son” may seem true on the surface, but with­out un­der­stand­ing the con­text in which it is made, it is im­pos­si­ble to de­ter­mine whether it is true or false. What does it mean to be a good per­son? What cri­te­ria should be used to eval­u­ate the state­ment? Are there time limits as to when good person applies, like when you’re with friends? But not with parents? Unrelated question, but are the girls who hang out by a bar in the late evening and wee early hours of morning good or bad? Doesn’t it depend on how bad she is?

The context of a state­ment or ac­tion is nec­es­sary to eval­u­ate it against a set of eth­i­cal or moral stan­dards. For ex­am­ple, the state­ment “Those girls out on the corner are bad women” may seem rea­son­able in some con­texts, but in oth­ers, it may be seen as a vi­o­la­tion of hu­man rights. With­out un­der­stand­ing the con­text in which the state­ment is made, it is im­pos­si­ble to de­ter­mine whether it is con­sis­tent with eth­i­cal or moral prin­ci­ples, whatever those nebulous concept may be.

Consider that con­text pro­vides a ba­sis for em­pa­thy. To un­der­stand the truth of a state­ment or ac­tion, it is of­ten nec­es­sary to put one­self in the shoes of the per­son mak­ing the state­ment or tak­ing the ac­tion. How­ev­er, with­out un­der­stand­ing the con­text in which the state­ment or ac­tion is made, it is im­pos­si­ble to ap­pre­ci­ate the per­spec­tive of the per­son in­volved. For ex­am­ple, a per­son may make a state­ment that seems in­sen­si­tive or of­fen­sive. How­ev­er, with­out context it is im­pos­si­ble to ap­pre­ci­ate the per­son’s background, ex­pe­ri­ences, or in­ten­tions. By way of example I think we’ve probably all seen YouTube videos of a Karen in action. We only see the expression of the moment a given Karen is filmed being Karen. We have no idea what “set her off.” Clearly such people have too much stress in their lives and just can not handle it. Who hasn’t been there and done that?

It’s necessary to understand the con­text of a state­ment or ac­tion to em­pathize with the ex­pe­ri­ences of oth­ers. For ex­am­ple, a per­son may make a state­ment that seems racist or sex­ist. How­ev­er, with­out un­der­stand­ing the his­tor­i­cal and cul­tur­al con­text in which the state­ment was made, it is im­pos­si­ble to ap­pre­ciate the im­pact of the state­ment on the peo­ple listening to it. Perhaps the best example of this kind of contextual clarification is what Tucker wrote about white men. He may or may not have actually written that note but whether he did or not when I read that in the context of other things he has said I think I know the truth of how racist that particular man is.

Forging Agreement’s newest on-demand workshop is available on Teachable now. Learn more about the ideas that John introduces in his blogs in the Program Theory On-Demand Workshop!

One way to think about how your mind works is to consider it as a biocomputer. It has an operating system and different types of applications and programs that run when called, in similar fashion to a regular computer. The results of this workshop will give you new ways to consider your own beliefs, emotions, feelings and logical thoughts and how you can choose to modify them to meet your own requirements.

The workshop combines a series of on-demand videos with group discussions. Program Theory is taught by John Worthington and Paul Grenci. Contact @forgingagreement on Facebook or Instagram or email [email protected] for more information!

The most recent online Reality Creation Through the Dyad Workshop has just wrapped up. The Dyad workshop is an exploration into the relationship that exists between two people- any two people. A Dyadic relationship can be with a spouse, significant other, business partner, co-workers, family members, etc. These relationships can be wonderful and challenging all at the same time, but that is the beauty of relationships; traversing the good, the bad and everything in between.

In this interactive workshop, couples/individuals are afforded the opportunity to examine ever so common problems and tried and true solutions that guarantee an ongoing relationship if one is warranted.

This workshop will be happening on a monthly basis and runs over 2 weeks of 4 consecutive evenings. Contact @forgingagreement on Facebook or Instagram or email [email protected] for more information!

If you would like to support John, please consider subscribing to Medium using his referral link. Due to Medium not supporting mobile-based referrals, please use a desktop browser to sign-up. This ensures that a portion of your commission goes straight to John to support his work on this blog. You will get unlimited access to all of John’s blogs, plus unlimited access to thousands of other writers. Thank you!

Politics
News Media
Context
Honesty
Leadership
Recommended from ReadMedium
avatarDr. Samantha Rodman Whiten (Dr. Psych Mom)
My Wife Is Fat

Reader Wife Is Fat writes:

8 min read