Mastering Nim: A complete guide to the programming language by Andreas Rumpf
Author:Andreas Rumpf [Rumpf, Andreas]
Language: eng
Format: epub, pdf
Published: 2023-08-21T18:30:00+00:00
Operators with one parameter are prefix operators, operators with two parameters are infix operators. (However, the parser distinguishes these from the operatorâs position within an expression.) There is no way to
declare postfix operators: all postfix operators are built-in and handled by the grammar explicitly.
Any operator can be called like an ordinary proc with the òpr\` notation.
(Thus an operator can have more than two parameters):
proc `*+`(a, b, c: int): int =
# Multiply and add
result = a * b + c
assert `*+`(3, 4, 6) == `+`(`*`(a, b), c)
21.1. Method call syntax
The syntax obj.methodName(args) can be used instead of methodName(obj,
args). The parentheses can be omitted if there are no remaining arguments: obj.len (instead of len(obj)).
This method call syntax is not restricted to objects, it can be used to supply any type of first argument for routines:
echo "abc" .len # is the same as echo len "abc"
echo "abc" .toUpper()
echo { 'a' , 'b' , 'c' }.card
stdout.writeLine( "Hallo" ) # the same as writeLine(stdout, "Hallo") Another way to look at the method call syntax is that it provides the missing postfix notation.
The method call syntax conflicts with explicit generic instantiations: p[T](x) cannot be written as x.p[T] because x.p[T] is always parsed as (x.p)[T].
See also: Section 27.17, âMethod call syntax limitationsâ.
The [: ] notation was designed to mitigate this issue: x.p[:T] is rewritten by the parser to p[T](x), x.p[:T](y) is rewritten to p[T](x, y). Note that [: ] has no AST representation, the rewrite is performed directly in the parsing step.
147
Download
Mastering Nim: A complete guide to the programming language by Andreas Rumpf.epub
Mastering Nim: A complete guide to the programming language by Andreas Rumpf.pdf
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Ajax | Assembly Language Programming |
Borland Delphi | C & C++ |
C# | CSS |
Compiler Design | Compilers |
DHTML | Debugging |
Delphi | Fortran |
Java | Lisp |
Perl | Prolog |
Python | RPG |
Ruby | Swift |
Visual Basic | XHTML |
XML | XSL |
Deep Learning with Python by François Chollet(12437)
Hello! Python by Anthony Briggs(9784)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9676)
The Mikado Method by Ola Ellnestam Daniel Brolund(9669)
Dependency Injection in .NET by Mark Seemann(9211)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8178)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7670)
Grails in Action by Glen Smith Peter Ledbrook(7591)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7431)
Becoming a Dynamics 365 Finance and Supply Chain Solution Architect by Brent Dawson(6557)
Microservices with Go by Alexander Shuiskov(6314)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6302)
Practical Design Patterns for Java Developers by Miroslav Wengner(6226)
Test Automation Engineering Handbook by Manikandan Sambamurthy(6200)
Angular Projects - Third Edition by Aristeidis Bampakos(5543)
The Art of Crafting User Stories by The Art of Crafting User Stories(5127)
NetSuite for Consultants - Second Edition by Peter Ries(5080)
Kotlin in Action by Dmitry Jemerov(4941)
Demystifying Cryptography with OpenSSL 3.0 by Alexei Khlebnikov(4877)
