Order
This manual describes the Nice programming language. It is currently being revised, which means that the language is incomplete in many ways, or that some parts are largely blank. In the meantime, it is recommended that you read "nice Tutorial" [http://nice.sf.net/language.html], which includes a lot of extra information. Reading these two documents requires some Java knowledge, or at least an object-oriented language.
The authors of this manual are Daniel Bonniot and Bryn Keller,francis Barber are also involved.
The first chapter basic principle
A language that doesn ' t affect the way you are about programming, is not worth knowing.
-alan J. Perlis
The art of progress is to preserve order amid change and to preserve change amid order.
-alfred North Whitehead
The nice language is a new java-based object-oriented language. It borrows some characteristics from functional language, and puts the academic achievements into practice artistically. These features make it more expressive (expressivity), modular structure (modularity), and security (safety).
Security
Nice at compile time can check out more errors than the existing object-oriented languages (null pointer accesses), type conversion exceptions (cast exceptions)). This means that programs written with Nice will no longer throw the infamous nullpointerexception and classcastexception. For more information on this, refer to http://nice.sf.net/safety.html.
Modular structure
In an object-oriented language, you can add a new class to an existing class inheritance structure. In Nice, you can also add a new method to an existing class without modifying the source file, which is a special case of the Multivariate method (Multi-methods).
Expressive Force
You can avoid many repetitive programming tasks by using the advanced features of Nice. Have you ever hated writing stacks of loops, type conversions, overloaded methods that use default values ...?
Chapter II Package
A package is a set of associated classes, methods, and variables. You can declare all the code under a package in a. nice file using the following statement:
Package package-name;
You can use the import statement to import all the public elements in another package:
Import Package-name;
Please note that this is slightly different from Java. In Java, you can import a class from a package independently. In Nice, methods can be declared outside of a class, so you must import the entire package to determine which methods are available in a class. This means that the Nice project must be designed with a smaller, complete package than Java.
As mentioned above, only the entire package can be imported, while a single class is not. Similarly, the package name does not need to be used in the same way as in Java. *. In fact, using. * Indicates that you want to import a Java package instead of a nice package. See the "Interacting with Java" section for more information.
Main method
A method is included in the package, its name is main, the return value is void, and a parameter of a string[] type is accepted. This method is very special, and the program in which it resides will be executed by this main method. The runtime system passes command-line arguments to the main method.
Note that because the main unit of code in Nice is a package rather than a class, the main method must be implemented outside of any class.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.