Content deleted Content added
m v2.05b - Bot T20 CW#61 - Fix errors for CW project (Reference before punctuation) |
|||
Line 51:
== Features ==
Mojo was created for an easy transition from Python. The language has syntax similar to Python's, with inferred static typing,<ref>{{Cite web |title=Modular Docs - Mojo🔥 programming manual |url=https://docs.modular.com/mojo/programming-manual.html#parameterization-compile-time-metaprogramming |access-date=2023-10-19 |website=docs.modular.com |language=en}}</ref>
The language also provides a [[borrow checker]], an influence from [[Rust (programming language)|Rust]].<ref>{{Cite web |title=Ownership and borrowing {{!}} Modular Docs |url=https://docs.modular.com/mojo/manual/values/ownership.html |access-date=2024-02-29 |publisher=Modular}}</ref> Mojo {{Mono|def}} functions use value semantics by default (functions receive a copy of all arguments and any modifications are not visible outside the function), while [[Python (programming language) | Python]] functions use reference semantics (functions receive a reference on their arguments and any modification of a mutable argument inside the function is visible outside).<ref>{{Cite web |title=Mojo🔥 programming manual |url=https://docs.modular.com/mojo/programming-manual.html |access-date=2023-06-11 |publisher=Modular |archive-url=https://web.archive.org/web/20230611225929/https://docs.modular.com/mojo/programming-manual.html |archive-date=2023-06-11 |quote=All values passed into a Python def function use reference semantics. This means the function can modify mutable objects passed into it and those changes are visible outside the function. However, the behavior is sometimes surprising for the uninitiated, because you can change the object that an argument points to and that change is not visible outside the function. All values passed into a Mojo function use value semantics by default. Compared to Python, this is an important difference: A Mojo def function receives a copy of all arguments— it can modify arguments inside the function, but the changes are not visible outside the function.}}</ref>
|