help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Check for redundancy


From: Emanuel Berg
Subject: Re: Check for redundancy
Date: Sun, 28 Jun 2015 04:02:27 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Stefan Nobis <snobis@gmx.de> writes:

> IMHO the most interesting part would be to identify
> similar code blocks (even using different functions
> and variables internally), that can be refactored to
> a new, more generalized function with
> apropriate parameters.
>
> But this "similiarity" is quite difficult. In the
> general case you could summarize all your code
> blocks into one single function and on the other
> hand there might be quite some functions that are
> quite similiar but should stay separated because
> this way the intentions are better expressed and the
> the code using these function will be more readable.
>
> Therefore training an AI to produce really helpful
> recommendations will be quite difficult, me thinks.

What I remember from the thrice-accursed textbooks on
AI the standard example was a machine playing
tic-tac-toe on a 3x3 grid (like in the Wargames
movie). To this end they made a physical array of
boxes that each would contain balls of different
colors. This would correspond to the heuristics of
search space traversal, and it would be gradually
refined for each game played. Soon the machine would
play a perfect game. When computers came they put this
into a program and the training consisted of the
program playing against another instance of itself.

This is all cool and well, but I still think it would
be much easier to base this on some base machine
representation. That way, you don't have to worry
about variable and function names as those would be
data and references in registers.

It doesn't have to be a perfect hit! You can have it
suggest here as well. But put it this way: if the
compiler can't put it into nearly the same form after
applying all optimization - either the compiler isn't
that good, or the functions just aren't the same.

I just got and idea - stay tuned...

-- 
underground experts united
http://user.it.uu.se/~embe8573




reply via email to

[Prev in Thread] Current Thread [Next in Thread]