[Laszlo-dev] How to fake yourself out in Java

P T Withington ptw at pobox.com
Fri Dec 5 06:57:59 PST 2008


You should have said:

define class <library-compilation> ()
   slot import-compiler :: <import-compiler>, required-init-keyword:  
import-compiler:;
   ...
end;

:)

I've never understood why Java/C++, which are all over all sorts of  
short-hands, make you have to type out by hand trivial constructors.   
Maybe some IDE's have a button to do that for you, but I would have  
made it part of the language.

On 2008-12-04, at 18:52EST, Henry Minsky wrote:

> I wrote a class which looked like this
>
> class LibraryCompilation {
>    ImportCompiler  importCompiler;
>    File infile;
>    String outfile;
>    String liburl;
>    Element element;
>
>    LibraryCompilation (ImportCompiler ImportCompiler, File infile,
> String outfile, String liburl, Element element) {
>        this.importCompiler  = importCompiler;
>        this.infile = infile;
>        this.outfile = outfile;
>        this.liburl = liburl;
>        this.element = element;
>    }
>
> I named the first arg to the constructor "ImportCompiler" instead of
> "importCompiler". The code compiled fine, but the
> value of the "importCompiler" slot was always null. Only took about
> fifteen or twenty minutes to figure this out :-(
>
> -- 
> Henry Minsky
> Software Architect
> hminsky at laszlosystems.com



More information about the Laszlo-dev mailing list