code reformatting

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

code reformatting

Zjnue Brzavi
Hi list,

There was an opportunity recently to develop some code reformatting
functionality. The code is heavily based on the hscript library
(extending Expr and Parser classes and contains some new ones to
generate code).

Very early days, but trying to subscribe to the 'release early..'
principle. However, legalese is causing a stumble from the outset.

It would be great to release the work in as permissable form as
possible and for the community. Where 'public domain' sounds a good
candidate in terms of permissability, I'm not sure if it is compatible
with the New BSD of hscript? If not, sticking to New BSD is probably
fine, but how?

For the existing classes, something like?

/* Modified by <new library> / <haXe> contributors
/*
 * Copyright (c) 2008, Nicolas Cannasse
 * All rights reserved.
 .. rest of New BSD

 and others

/*
 * Copyright (c) 2008, <new library> / <haXe> contributors
 * All rights reserved.
 .. rest of New BSD

In terms of ownership - it would be great to have the code belong to
as big a community as possible. Would 'haXe contributors' be ok here?
Or use the name of the library for <new library> instead?

As for the library name, it would be good to know that it does not
offend, infringe, etc. The current name is 'hrescript', as it offers
re-scripting (reformatting) capabilities (for as2 and haXe at the
moment), but also tries to experiment with extensions to the hscript
library for potentially more interpretation, code translation and
generation capabilities. Therefore it seemed fitting for the library
to bear a close resemblance in name also. Please share your opinions
on this - names like 'synthaxe' or whatever fits with generation, but
drifts further away form other freedoms the library may try to
support. Finally, a Google Code page (without code) already exists for
hrescript, so if no problem to stay with that, it would be nice not to
waste a 1/10 free project hosting window :)

It would be much appreciated to get some feedback on the above, before
getting it all wrong and causing damage.

Many thanks,
Zjnue

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: code reformatting

Daniel Turing
Zjnue,

On Tue, 2008-11-04 at 17:50 +0000, Zjnue Brzavi wrote:
> Where 'public domain' sounds a good
> candidate in terms of permissability, I'm not sure if it is compatible
> with the New BSD of hscript? If not, sticking to New BSD is probably
> fine, but how?

IANAL, but AFAIK, you cant put copyrighted code (or text, for that
matter) under the public domain; only the author(s) can, and that seems
to be untrue for some legislations at least.

> In terms of ownership - it would be great to have the code belong to
> as big a community as possible.

again, as i understand international copyright law, the author is and
will always be the copyright holder. only rights of use/sale etc can be
transferred. you cannot 'give' code away, you can only grant licenses
for use, modification, redistribution etc. this is exactly what the BSD
license does, in probably the most liberal terms imaginable (at least if
you drop the third, keep-the-copyright-notice, clause).

xinf, for example, states "(C) the xinf contributors", but that is
really only a simplification. in reality, every individual author
retains copyright for every letter (s)he contributed.

looking forward to the reformatter tho :)

-dan



--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: code reformatting

Juan Delgado
I'm half way through the book Intellectual Property and Open Source:

http://www.amazon.com/dp/0596517963/ref=nosim/?tag=slashdot0c-20

I've recently blogged about it:

http://blog.zarate.tv/2008/11/02/intellectual-property-and-open-source/

And I'd say Daniel is right. But it seems you are actually forking
hscript, right? Sadly the book has no chapter on forks (just checked
now) but I'd say you should go as you planned. That's keeping original
hscript license and then add a note about who did the modification. In
my case, I made some modifications to swhx.Api and I kept original
license plus added a note to the documentation:

http://hippohx.googlecode.com/svn/trunk/src/client/as3/com/hippohx/Api.as

Just for the record all HippoHX code is assigned to "HippoHX's
contributors" although I've written myself most of it.

Looking forward to see it in action too!

Juan

On Tue, Nov 4, 2008 at 6:10 PM, Daniel Turing <[hidden email]> wrote:

> Zjnue,
>
> On Tue, 2008-11-04 at 17:50 +0000, Zjnue Brzavi wrote:
>> Where 'public domain' sounds a good
>> candidate in terms of permissability, I'm not sure if it is compatible
>> with the New BSD of hscript? If not, sticking to New BSD is probably
>> fine, but how?
>
> IANAL, but AFAIK, you cant put copyrighted code (or text, for that
> matter) under the public domain; only the author(s) can, and that seems
> to be untrue for some legislations at least.
>
>> In terms of ownership - it would be great to have the code belong to
>> as big a community as possible.
>
> again, as i understand international copyright law, the author is and
> will always be the copyright holder. only rights of use/sale etc can be
> transferred. you cannot 'give' code away, you can only grant licenses
> for use, modification, redistribution etc. this is exactly what the BSD
> license does, in probably the most liberal terms imaginable (at least if
> you drop the third, keep-the-copyright-notice, clause).
>
> xinf, for example, states "(C) the xinf contributors", but that is
> really only a simplification. in reality, every individual author
> retains copyright for every letter (s)he contributed.
>
> looking forward to the reformatter tho :)
>
> -dan
>
>
>
> --
> haXe - an open source web programming language
> http://haxe.org
>



--
Juan Delgado - Zárate
http://zarate.tv
http://dandolachapa.com
http://loqueyosede.com

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: code reformatting

Zjnue Brzavi
In reply to this post by Daniel Turing
Hi Dan, Juan,

Thanks for the help and sorry for disappearing straight after my post
..dem coppers ;)
Yes, these clauses. I asked Nicolas about it too and he thinks it is
good to stick with New BSD.
I agree, it will avoid complication. My first choice was /*before
suing us, please consult your inner child*/.
At least they got us to acknowledge these important facts of life, so
everyone should be happy.

As for the code re-formatter library:

- I'm happy to say that it is already a team effort. Two brand new
haXers, Ram and Sainath, did very well to absorb many of the advanced
haXe types and features - a testament to haXe and their adoption
abilities for sure.
- It is really very early days for the library and the google code
reference is probably best left for people either in direct need of a
code formatter, willing to tolerate lots of rough edges and project
flux, or people interested in sharing ideas for extending hscript, at
this stage.
- It is not trying to be a powerbase in any way, but more of a channel
for exploration and hopefully if there are worthy features, they may
find their way back into hscript.

Apart from that, it is worth mentioning that the field
(parsers,lexers,asts,interpretation,etc) is pretty new to us, so
please don't hold back with criticisms, suggestions, etc.

Current features:

- I think the AS2 re-formatting pretty much works.

- haXe reformatting has a known issue with conditional compilation, as
it is really taking a short-cut to deal with it right now.
Essentially, conditional blocks are implemented much like normal
if-else blocks and relies on having valid statements as contents. Ie:

// works
#if flash
trace();
#end

// does not work (because 'middleC,' is not a normal valid statement)
function hmm( a, #if flash middleC, #end b ) {}

- The whitespace values should really come from CSS at some point and
the xinf CSS implementation may be a good call, as I think HSS is
fixed at html properties atm.

Future areas:

- in terms of interpretation, the lively project looks pretty interesting..
http://research.sun.com/projects/lively/
http://www.youtube.com/watch?v=gGw09RZjQf8

- if we can get a representable AST together for common language
features between targets, translation, interpretation and generation
between these languages should be possible.
in this light JS-rich SVG component consumption and absorption may
become more feasible.

- in order to regenerate code from the ASTs, we store most values in a
raw state (not friendly for interpretation). What would be great is to
find a harmony between the needs for interpretation and code
re-generation and have one shared structure for all needs, allowing
the injection of some extra meta information when required (for
regeneration), but ignored by processes that don't need it (the
interpreters). all a bit wishful guesswork, so hopefully the more
informed will have suggestions or comments here.

- of course, the reformatter needs to be IDE plug-friendly - not sure
if the approach will provide fast enough execution though.

- cleanup, efficiencies, etc

Here is the URL:
http://hrescript.googlecode.com/svn/trunk/

Please share ideas and/or report any bugs you encounter.

Thanks,
Zjnue

--
haXe - an open source web programming language
http://haxe.org