mumuki / mumuki-laboratory

:microscope: Where students practice and receive automated and human feedback
http://mumuki.io
GNU Affero General Public License v3.0
203 stars 26 forks source link

Interpolation of extra code with student solution #463

Closed mmatos closed 8 years ago

mmatos commented 8 years ago

I'm making a guide for Wollok language and it happens a lot that the student needs to copy and paste a lot of code from a previous exercise because the language doesn't have open classes, which means that it's not possible to put in the extra code a class definition with the part of the logic that is required but not requested by the current exercise.

It would be great if it was possible to define a class in the extra code and then incorporate into it the new additions from the solution before appending to the final code that will be used for running the test cases.

PalumboN commented 8 years ago

+1

And we can aim to include open classes (and objects) in Wollok :P It would be very useful for Wollok Game, too.

Another option, I'm brainstorming, can be that Mumuki copy-pastes before exercise's code when current exercise hasn't submits.

flbulgarelli commented 8 years ago

Hi,

definitely we need in the future a more sophisticated way of interpolating extra codes into the submission. For example, in Haskell we usually want to add imports in the extra code, but it is not currently possible, since imports can only be in the top of the file.

The same problem applies to Java, for example.

In the case of wollok, interpolating methods is even more complex, since we would need to have multiple non-predefined insertion points, I can't figure out how to solve that without open clases.

Finally, what @PalumboN asks is already reported here #455

To sum up:

flbulgarelli commented 8 years ago

Hi @mmatos I am now implementing a advanced interpolation mechanism - initially for wollok, but which is easy to extend to other languages for such situations.

/*...extra...*/

test "...." {
  /*...content...*/
}

or

/*...extra...*/

test "...." {
  /*...content...*/
}

or

content:

object pepita {
    /*...mas metodos...*/
}

extra:

/*<mas metodos#*/

method metodo1() = 4
method metodo2() = 3

/*#mas metodos>*/

test:

/*...content...*/

test "pepita puede volar" {

}
flbulgarelli commented 8 years ago

This feature is now available to all languages. Closing