suggestions for newbee
David Bernard <[email protected]> Tue, 05 Jul 2005 22:26:37 +0200
| Newsgroups | gmane.comp.lang.nice.general |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I'm newbee, and I've got some suggestions, questions. First I would say
that, something I like when I beginned in Java and when I debug/improve
existing lib/application is the coding convention +/- enforce by the
compiler. The goal of the following suggestion is to enforce some
coding convention at the nice compilater level :
* remove 'var' and 'let'. If 'let' is to define constantes (!=
immutable) then every constantes have name in uppercase (only), and
variable start by lowercase. Compiler could automaticaly detect this and
choose internaly between 'var' and 'let' rules.
* Why 'Type Inference' isn't systematic, and can't be use for arrays ?
Could you give me samples ?
* Why not use
* Why do you choose to allow multiple class declaration in one file ?
One thing, I dislike in C, C++ is to search for where is the
implementation of the class X, the method Y,... and not in Java. But in
java what is the need to duplicate information like the package name and
the classname (lot of developper, like me, create one file per class
public or not). So the suggestion is for the nice compiler to define the
package from the directory hierarchy, and the target class definition or
class addon from the name of File. It need to open and write more files
but for growing project it's a plus (with or without IDE).
-------- before -------------------------------------------------------
//sample.nice
class Person
{
String name;
int age;
String display();
}
class Worker extends Person
{
int salary;
}
display(Person p)
{
return p.name + " (age=" + p.age + ")";
}
display(Worker p)
{
return p.name + " (age+" + p.age + ", salary=" + p.salary + ")";
}
-------- after -------------------------------------------------------
//Person.nice
String name;
int age;
String display() {
return name + " (age=" + age + ")";
}
.................................
//Worker.nice
extends Person;
int salary;
String display() {
return name + " (age=" + age + ", salary=" + salary + ")";
}
---------------------------------------------------------------
* like generate a default Constructor, why not generate default
implementation for toString() (e.g. generate a string following the
format of JSON http://www.json.org) and equals() comparison by fields
(usefull for test) ?
I've got other may be stupid suggestion and question, I keep them for
future ;-) (and I don't finish to read all the aviailable doc).
I'm a newbee in compilation and language developpement, but I could try
to help you develop nice.
Thanks for time.
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click