Code Monkey home page Code Monkey logo

Comments (6)

vrandezo avatar vrandezo commented on May 6, 2024 1

@thadguidry kinda. The advantage we have is that we have no polymorphism, so it can be hopefully easier.

from abstracttext.

thadguidry avatar thadguidry commented on May 6, 2024

Something like Type Erasure in Java? https://www.baeldung.com/java-generics#type-erasure
This JEP218 might also provide some food for thought in the greater context of parametric polymorphism.

from abstracttext.

arthurpsmith avatar arthurpsmith commented on May 6, 2024

So what would be the 'type' of Z8 then? Function(Type, [Type, List])? I don't quite see how this works, but it sounds intriguing... How would you express that in json?

In general I think we need to think a bit more about inheritance here. There is already something implicit here with Z1 - zobject as a type; I don't think you have any entity so far that is explicitly of type Z1, but Z1 encompasses all types, so that an object that takes a Z1 argument is actually able to accept any type. So maybe explicitly typed functions (with return type and arguments) can coexist here with a general Z8 - rather than change the meaning of Z8 as it is, perhaps new zobjects should be created for the generics?

from abstracttext.

vrandezo avatar vrandezo commented on May 6, 2024

@arthurpsmith yes, that's a great point. I was hoping that the type of the add function would indeed be something like Function(Boolean, [Boolean, Boolean])

In JSON notation, we first would need a Quote mechanism, say, Z99 is the same as Z7 but it is quoted (as in Lisp). So Add would look like:

{
  "Z1K1": "Z8",
  "Z1K2": "Z57",

But it could look like this instead:

{
  "Z1K1": {
    "Z1K1: "Z99",
    "Z99K1": "Z8",
    "Z8K1": "Z50",
    "Z8K2": [ "Z50", "Z50" ]
  },
  "Z1K2": "Z57",

Now if you unquote the Z99, you'll get

  "Z1K1: "Z7",
  "Z7K1": "Z8",
  "Z8K1": "Z50",
  "Z8K2": [ "Z50", "Z50" ]

which is the function call Z8(Z50, [Z50, Z50]), and when that is evaluated we get a new object of type Z4.

But we can use the quoted function for checking that is a function and its argument types easily.

Now as you point out, Z1 is a form of any type already. So should there be something like an any-function type, and probably yes, because what else would be the the signature of a function such as Z592 signature? (Hmm, could it be Z8(Z1, Z1), though?)

So unsure about the latter thing.

Thoughts are welcome.

from abstracttext.

arthurpsmith avatar arthurpsmith commented on May 6, 2024

The quoting approach might be reasonable. Presumably it could be nested? So you could have

  {
  "Z1K1": {
    "Z1K1": "Z99",
    "Z99K1": "Z8",
    "Z8K1": {
      "Z1K1": "Z99",
      "Z99K1": "Z8",
      "Z8K1": "Z50",
      "Z8K2": ["Z50"]
    }
    "Z8K2": [ "Z50", "Z50" ]
  },...

if you wanted the function to return a function rather than a number or whatever Z50 is?

Without something like that we would get a combinatorial explosion of types...

from abstracttext.

vrandezo avatar vrandezo commented on May 6, 2024

Yes, absolutely!

from abstracttext.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.