vendredi 17 mars 2017

Which are the cases that make it hard to distinguish between code and data?

It is said code is data (and vice versa, i.e. homoiconic) in Rebol and Red. Also, it is said that it's impossible to distinguish between the two. My understanding is that there are 2 cases here:

  1. Determine with certainty code from a mix of code and data
  2. Determine with certainty data from a mix of code and data

mix of code and data is my name for what outsiders would usually call Rebol code, and experienced Rebol programmers say is data (there is no code, only data)

Motivation

The code vs data distinction makes some features in programming languages easier. For e.g. disassembly was mentioned (sbcl has the disassemble function).

Question

What are examples of these problematic cases?

context:

from chat on March 15, 2017 3:32 PM: (emphasis mine)

Didec: You forget that there is no code in Rebdol, only data.

Maximvl: well, it's same for CL and SBCL complies everything down to native code and since code = data, one can say that there is no data, only code

It is not the same in Lisp languages, there is a distinction between "code" and "data" [in lisp], as code has to start with a call. Redbol has no such restriction on code, which makes it very different.

also:

Moreover, contexts and dynamic binding makes it way more flexible, but at the same time, translating directly to low-level assembly code, like in your CL example, is not possible.

Aside: Does this mean Rebol is more homiconic than lisp?





Aucun commentaire:

Enregistrer un commentaire