Miércoles 21/04/2021

Insides on evaluate and on how to Access JS Methods

Lest’s follow step by step the file examples/map-js-chain.egg.evm

remote: ULL-ESIT-PL-2021/private-egg path: campus-virtual/shared/egg/eloquentjsegg

  eloquentjsegg git:(private2021)  head examples/map-js-chain.egg.evm
{
  "type": "apply",
  "operator": {
    "type": "word",
    "name": "do"
  },
  "args": [
    {
      "type": "apply",
      "operator": {

resulting from compiling this Egg program:

do(
    define(x, array(1,2,3,4)),
    define(inc, fun(x,i,_, +(x,1))),
    print(x["map"](inc))
)

this allow us to dig in the following points:

  • The uplifting of ASTs from JSON to objects and from objects to Classes
  • Review how the evaluation process works
  • The evaluation of JS methods

Insides on Currying

Let us follow with the debugger the execution of this program

  eloquentjsegg git:(private2021)  cat examples/curry-method.egg 
do {
  print(4["+", 5](3)) # 4.(+,5)(3) # 12
}

Video

Que hemos visto

Insides on how to access the methods of the underlying JS objects