Skip to content

Commit

Permalink
Merge pull request modular#1661 from nmsmith/main
Browse files Browse the repository at this point in the history
Fix various typos in documentation
  • Loading branch information
arthurevans authored Jan 25, 2024
2 parents ce77443 + f4b23aa commit 3818448
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 20 deletions.
6 changes: 3 additions & 3 deletions docs/manual/lifecycle/index.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,19 @@
"tools for systems programming, but within a framework that helps you build\n",
"things that are safe and easy to use from higher-level programs. That is, you\n",
"can get under the hood and write all the \"unsafe\" code you want, but as long as\n",
"you do so in accordance to Mojo's [value\n",
"you do so in accordance with Mojo's [value\n",
"semantics](/mojo/manual/values/value-semantics), the programmer instantiating\n",
"your type/object doesn't need to think about memory management at all, and the\n",
"behavior will be safe and predictable, thanks to [value\n",
"ownership](/mojo/manual/values/ownership.html).\n",
"\n",
"In summary, it's the responsibility of the type author to manage the memory and\n",
"resources for each value type, by implementing specific lifecycle methods, such\n",
"as the constructor, copy construct, move constructor, and destructor, as\n",
"as the constructor, copy constructor, move constructor, and destructor, as\n",
"necessary. Mojo doesn't create any of these by default.\n",
"\n",
"In the following pages, we'll explain exactly how to define these lifecycle\n",
"methods in accordance to value semantics so your types play nicely with value\n",
"methods in accordance with value semantics so your types play nicely with value\n",
"ownership."
]
},
Expand Down
4 changes: 2 additions & 2 deletions docs/manual/lifecycle/life.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"[`Int`](/mojo/stdlib/builtin/int.html#int), and\n",
"[`String`](/mojo/stdlib/builtin/string.html#string), up to complex types such\n",
"as [`SIMD`](/mojo/stdlib/builtin/simd.html#simd) and\n",
"[`object`](/mojo/stdlib/builtin/object.html#object)—are all defined as a\n",
"[`object`](/mojo/stdlib/builtin/object.html#object)—are defined as a\n",
"[struct](/mojo/manual/structs.html). This means the creation and\n",
"destruction of any piece of data follows the same lifecycle rules, and you can\n",
"define your own data types that work exactly the same way.\n",
Expand Down Expand Up @@ -65,7 +65,7 @@
"`state` field is also useless because it cannot be initialized (Mojo structs do\n",
"not support default field values—you must initialize them in a constructor).\n",
"\n",
"So the only thing you can do is call on the static method:"
"So the only thing you can do is call the static method:"
]
},
{
Expand Down
21 changes: 10 additions & 11 deletions docs/manual/parameters/index.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Many languages have facilities for _metaprogramming_: that is, for writing code that generates or modifies code. Python has facilities for dynamic metaprogramming: features like decorators, metaclassess, and many more. These features make Python very flexible and productive, but since they're dynamic, they come with runtime overhead. Other languages have static or compile-time metaprogramming features, like C preprocessor macros and C++ templates. These can be limiting and hard to use.\n",
"Many languages have facilities for _metaprogramming_: that is, for writing code that generates or modifies code. Python has facilities for dynamic metaprogramming: features like decorators, metaclasses, and many more. These features make Python very flexible and productive, but since they're dynamic, they come with runtime overhead. Other languages have static or compile-time metaprogramming features, like C preprocessor macros and C++ templates. These can be limiting and hard to use.\n",
"\n",
"To support Modular's work in AI, Mojo aims to provide powerful, easy-to-use metaprogramming with zero runtime cost. This compile-time metaprogramming uses the same language as runtime programs, so you don't have to learn a new language—just a few new features.\n",
"\n",
Expand Down Expand Up @@ -292,18 +292,18 @@
"[Single instruction, multiple data (SIMD)](https://en.wikipedia.org/wiki/Single_instruction,_multiple_data) is a parallel processing technology built into many modern CPUs,\n",
"GPUs, and custom accelerators. SIMD allows you to perform a single operation on\n",
"multiple pieces of data at once. For example, if you want to take the square \n",
"root of each element in array, you can use SIMD to parallelize the work. \n",
"root of each element in an array, you can use SIMD to parallelize the work. \n",
"\n",
"Processors implement SIMD using low-level vector registers in hardware that hold\n",
"multiple instances of a scalar data-type. In order to use the SIMD instructions\n",
"multiple instances of a scalar data type. In order to use the SIMD instructions\n",
"on these processors, the data must be shaped into the proper SIMD width\n",
"(data type) and length (vector size). Processors may support 512-bit or\n",
"longer SIMD vectors, and support many data types from 8-bit integers to 64-bit \n",
"floating point numbers, so it's not practical to define all of the possible SIMD\n",
"variations. \n",
"\n",
"Mojo's [`SIMD`](/mojo/stdlib/builtin/simd.html) type (defined as a struct)\n",
"exposes the common SIMD operations in its methods, and makes the SIMD data type\n",
"exposes the common SIMD operations through its methods, and makes the SIMD data type\n",
"and size values parametric. This allows you to directly map your data to the \n",
"SIMD vectors on any hardware.\n",
"\n",
Expand Down Expand Up @@ -551,7 +551,7 @@
"metadata": {},
"source": [
"Notice that the `x` argument is actually a `SIMD` type based on the function\n",
"parameters. The runtime program can use the value of parameters, because the\n",
"parameters. The runtime program can use the value of the parameters, because the\n",
"parameters are resolved at compile-time before they are needed by the runtime\n",
"program (but compile-time parameter expressions cannot use runtime values).\n",
"\n",
Expand Down Expand Up @@ -601,8 +601,8 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Recall that Mojo can infer parameter values in a parametric function, based on\n",
"the parametric values attached to an argument value (see the `rsqrt[]()`\n",
"Recall that when a parametric function is called, Mojo can infer the parameter values.\n",
"That is, it can use the parameter values attached to an argument value (see the `sqrt[]()`\n",
"example above). If the parametric function also has a default value defined,\n",
"then the inferred parameter type takes precedence.\n",
"\n",
Expand Down Expand Up @@ -721,8 +721,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Note how the resulting length is the sum of the input vector lengths, and you\n",
"can express that with a simple `+` operation. \n",
"Note that the resulting length is the sum of the input vector lengths, and this is expressed with a simple `+` operation. \n",
"\n",
"### Powerful compile-time programming\n",
"\n",
Expand Down Expand Up @@ -898,7 +897,7 @@
"works as a runtime value) naturally. Note that this is invoking the\n",
"runtime constructor for `DType` at compile-time.\n",
"\n",
"Types are another common use for alias. Because types are compile-time\n",
"Types are another common use for aliases. Because types are compile-time\n",
"expressions, it is handy to be able to do things like this:"
]
},
Expand All @@ -911,7 +910,7 @@
"alias Float16 = SIMD[DType.float16, 1]\n",
"alias UInt8 = SIMD[DType.uint8, 1]\n",
"\n",
"var x : Float16 # FLoat16 works like a \"typedef\""
"var x : Float16 # Float16 works like a \"typedef\""
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion docs/manual/traits.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@
"source": [
"## Generic structs with traits\n",
"\n",
"You can also use traits when defining a generic containers. A generic container\n",
"You can also use traits when defining a generic container. A generic container\n",
"is a container (for example, an array or hashmap) that can hold different data\n",
"types. In a dynamic language like Python it's easy to add different types of\n",
"items to a container. But in a statically-typed environment the compiler needs\n",
Expand Down
2 changes: 1 addition & 1 deletion docs/manual/values/index.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"destroyed so that memory becomes available for other code.\n",
"\n",
"Notice that we said only \"_fixed-size_ local values\" are stored in the stack.\n",
"Any dynamically-sized values that can change in size at runtime are instead\n",
"Dynamically-sized values that can change in size at runtime are instead\n",
"stored in the heap, which is a much larger region of memory that allows for\n",
"dynamic memory access at runtime. Technically, a local variable for such a value\n",
"is still stored in the call stack, but its value is a fixed-size pointer to the\n",
Expand Down
4 changes: 2 additions & 2 deletions docs/manual/values/value-semantics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"title: Value semantics\n",
"order: 2\n",
"sidebar_position: 2\n",
"description: An explanation of Mojo's value semantic defaults.\n",
"description: An explanation of Mojo's value-semantic defaults.\n",
"css: /static/styles/page-navigation.css\n",
"website:\n",
" open-graph:\n",
Expand Down Expand Up @@ -47,7 +47,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"In the most basic situation, sharing a value semantic type means that you create\n",
"In the most basic situation, sharing a value-semantic type means that you create\n",
"a copy of the value. This is also known as \"pass by value.\" For example,\n",
"consider this code:"
]
Expand Down

0 comments on commit 3818448

Please sign in to comment.