a question on diff modules

J

jm

A notice that there is a few diff modules of raa. Two questions,

1) Are any of these the "accepted standard"?
2) Can any of these take the original array/string/obj/whatever and the
diff it generated and produce the second array that was used to
generate the diff, ie undo the generated diff?


J.
 
A

Austin Ziegler

A notice that there is a few diff modules of raa. Two questions,

1) Are any of these the "accepted standard"?
2) Can any of these take the original array/string/obj/whatever and the
diff it generated and produce the second array that was used to
generate the diff, ie undo the generated diff?

1) No. Algorithm::Diff by Lars is good, but it is GPL-only. Make sure
your licence is compatible. It can do some patching, and I did some
work to do some unpatching on it, but it's not in the released
version.
2) Diff::LCS 1.1 (coming soon) will support full context patching and
unpatching, but you will have to use a particular sort of call to make
it happen.

-austin
 
C

Carl Youngblood

Okay, I know this has probably been rehashed hundreds of times, but I
was under the impression that merely using a piece of GPL source in my
code didn't affect the rest of my code. Is this wrong? Even if I
don't modify the code at all? If I modify it, isn't it true that all
I have to do is publish the source for my modifications in the event I
release the software to the public?

Thanks,
Carl
 
A

Austin Ziegler

Okay, I know this has probably been rehashed hundreds of times, but I
was under the impression that merely using a piece of GPL source in my
code didn't affect the rest of my code. Is this wrong? Even if I
don't modify the code at all? If I modify it, isn't it true that all
I have to do is publish the source for my modifications in the event I
release the software to the public?

This is wrong. GNU GPL supporters don't like hearing this, but the GNU
GPL is viral. This is a *feature* of the licence, but it can also be a
"gotcha" if you don't know what you're doing. The trick is in defining
what a derivative work is, and it's actually messier with a dynamic
language like Ruby than it is with a semi-dynamic language like Java,
where it's a big mess period.

The inclusion of GPLed code in your own -- that can be as simple as
linking (in the case of Ruby, "require") -- requires that your code be
available in a GPL-compatible licence. You cannot grant extra rights
on GPLed code that you do not own, which means that if your code is
dual-licensed and you include GPLed code, then the combination of your
dual-licensed code and GPLed code can *only* be distributed under the
GPL (this is why Diff::LCS was originally created; Ruwiki is under
Ruby's dual licensing scheme; however, Algorithm::Diff was GPL-only;
thus, a Ruwiki+Algorithm::Diff package could only be under the GPL).

The LGPL is friendlier, but not much -- it requires that you make your
application available as relinkable object files so that if someone
changes the GPLed library, they can relink your application using it.

I personally don't like the GPL. There are a lot of reasons for that.
1) Most people don't get the GPL. 2) A lot of advocates use misleading
double-talk (and sometimes outright lies) regarding the GPL. 3) There
is a lot of political bunkus in the preamble of the GNU GPL that I
don't particularly want to provide with my software.

The GPL *is* a viral license, and it's a feature -- it is, I would
argue, the central feature of the GPL. There is a place for such
licences, but don't attempt to tell me that adding the restrictions
inherent in the GPL actually "frees" my code. Software is not, as of
yet, an entity that can be freed as slaves could (I have actually had
advocates use that line of reasoning with me). The restrictions in the
GPL are good, so long as they are not misrepresented and they are
fully understood. Those restrictions result in general source code
availability for everyone as well as a strong lack of restrictions on
what can be done with such source code.

-austin
 
M

Mark Sparshatt

Austin said:
This is wrong. GNU GPL supporters don't like hearing this, but the GNU
GPL is viral. This is a *feature* of the licence, but it can also be a
"gotcha" if you don't know what you're doing. The trick is in defining
what a derivative work is, and it's actually messier with a dynamic
language like Ruby than it is with a semi-dynamic language like Java,
where it's a big mess period.

The inclusion of GPLed code in your own -- that can be as simple as
linking (in the case of Ruby, "require") -- requires that your code be
available in a GPL-compatible licence. You cannot grant extra rights
on GPLed code that you do not own, which means that if your code is
dual-licensed and you include GPLed code, then the combination of your
dual-licensed code and GPLed code can *only* be distributed under the
GPL (this is why Diff::LCS was originally created; Ruwiki is under
Ruby's dual licensing scheme; however, Algorithm::Diff was GPL-only;
thus, a Ruwiki+Algorithm::Diff package could only be under the GPL).

The LGPL is friendlier, but not much -- it requires that you make your
application available as relinkable object files so that if someone
changes the GPLed library, they can relink your application using it.

I personally don't like the GPL. There are a lot of reasons for that.
1) Most people don't get the GPL. 2) A lot of advocates use misleading
double-talk (and sometimes outright lies) regarding the GPL.

But so do a lot of the GPL's opponents
3) There
is a lot of political bunkus in the preamble of the GNU GPL that I
don't particularly want to provide with my software.

The GPL *is* a viral license, and it's a feature -- it is, I would
argue, the central feature of the GPL. There is a place for such
licences, but don't attempt to tell me that adding the restrictions
inherent in the GPL actually "frees" my code. Software is not, as of
yet, an entity that can be freed as slaves could (I have actually had
advocates use that line of reasoning with me).

I thought the point of the GPL was to free users, not code.
The restrictions in the
GPL are good, so long as they are not misrepresented and they are
fully understood. Those restrictions result in general source code
availability for everyone as well as a strong lack of restrictions on
what can be done with such source code.
The rest I agree with. If a program you release contains parts written
by other people and released under the GPL then the whole thing must be
GPLed as well.
 
A

Aredridel

Okay, I know this has probably been rehashed hundreds of times, but I
was under the impression that merely using a piece of GPL source in my
code didn't affect the rest of my code. Is this wrong? Even if I
don't modify the code at all? If I modify it, isn't it true that all
I have to do is publish the source for my modifications in the event I
release the software to the public?

That's the Lesser GPL. The GPL is more infectious: You have to have a
compatible license to use GPL'ed code in your own product -- be it a
BSD License or Ruby's, you have to at least make your own code equally
or less restricted than the GPL.

There's weird caveats regarding linking, especially with languages as
dynamic and fluid as Ruby, but that's pretty much the reality.
 
J

jm

Thanks. Two things.

1) I get the following while attempting to install Diff::LCS

Generating HTML...

lcs.rb: mmm......mc............
array.rb: c
block.rb: c...
callbacks.rb: cc...cc...c....c.....cc.
change.rb: c.........
event.rb: c.
hunk.rb: c............
string.rb: c
Generating RI...
Couldn't build Ri documentation
Unhandled special: Special: type=17, text="Computes"
install.rb:171:in `install_binfile': undefined local variable or method
`opfile' for main:Object (NameError)
from install.rb:25:in `do_bins'
from install.rb:23:in `each'
from install.rb:23:in `do_bins'
from install.rb:205


Not a problem. I just copied lib/diff to the correct spot, but thought
I should let you know anyway. In case it helps here's uname's output
and rthe ruby version I'm runnung

$ uname -a
Darwin lemure.local 7.4.0 Darwin Kernel Version 7.4.0: Wed May 12
16:58:24 PDT 2004; root:xnu/xnu-517.7.7.obj~7/RELEASE_PPC Power
Macintosh powerpc

$ ruby -v
ruby 1.8.1 (2003-12-25) [powerpc-darwin]

oh, almost forget this is version 1.0.2 of Diff::LCS

2) I think I've spotted a bug consider the following,

irb(main):031:0> seqw = %w(abcd efgh ijkl mnopqrstuvwxyz)
=> ["abcd", "efgh", "ijkl", "mnopqrstuvwxyz"]

irb(main):032:0> Diff::LCS.diff(seqw,[])
=> [[#<Diff::LCS::Change:0x55b068 @text="efgh", @position=1,
@action="-">, #<Diff::LCS::Change:0x55b040 @text="ijkl", @position=2,
@action="-">, #<Diff::LCS::Change:0x55afb4 @text="mnopqrstuvwxyz",
@position=3, @action="-">]]

irb(main):033:0> Diff::LCS.diff([],seqw)
=> [[#<Diff::LCS::Change:0x5587c8 @text="abcd", @position=0,
@action="+">, #<Diff::LCS::Change:0x55878c @text="efgh", @position=1,
@action="+">, #<Diff::LCS::Change:0x558750 @text="ijkl", @position=2,
@action="+">, #<Diff::LCS::Change:0x558714 @text="mnopqrstuvwxyz",
@position=3, @action="+">]]
irb(main):034:0>


note the lack of "abcd" as a change in line 2. I would have expected
the only difference to be "-" to be changed to "+" between the two
calls. What happened to position 0 in the first call?

J.
 
A

Austin Ziegler

[install.rb problem]

Thanks. I actually discovered this myself in a later test. One of the
problems with maintaining one's own installer is, of course, bugs in
the installer. I think that I've fixed this and I will release a 1.0.3
in the next week to fix the installer.
2) I think I've spotted a bug consider the following,

irb(main):031:0> seqw = %w(abcd efgh ijkl mnopqrstuvwxyz)
=> ["abcd", "efgh", "ijkl", "mnopqrstuvwxyz"]
...

I'll look into that. I'm not sure where that disappeared to.

-austin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,990
Messages
2,570,211
Members
46,796
Latest member
SteveBreed

Latest Threads

Top