Git Product home page Git Product logo

delisp's People

Contributors

davazp avatar dependabot[bot] avatar heeboa avatar pmarino90 avatar tkers avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

davazp

delisp's Issues

Provide a node.js require hook?

Should it be a separate package @delisp/require or just a separate entry-point into @delisp/core?

It's nice to have multiple packages but most likely they should always require exactly the same version across all packages.

This library makes hooking into require easier:
https://www.npmjs.com/package/pirates

Implement extensible records

Support for row types have been implemented by c81ad6b, 7448c2c and 07827cd.

However, we are still missing:

  • Add name of the rules from the paper to the code to help to correlate them.
  • Comment a bit the idea
  • Add the constraint tail(r ) ∈/ dom(θ) to the uni-row rule.
  • Do kind-checking on the types to reject wrong uses of types
  • Improve record type syntax
    • Ensure the pipe component { | r} of the syntax appears the last in the map.
  • Implement record-related primitives

Display the resultingType of unknown variables

The self-type of unknown variables is a fresh type varaible, which is not very useful.

However, the resultingType have been exposed to the constraints of the code so it gives nicer information.

For instance, for

(lambda (x) (f 10))

where f is a free variable, the selfType is t1, but the resultingType is (-> ctx number e b)

The resultingType can be used for autocompletion for instance.

Introduce type variable `id`

Use an id to compare types instead of name. We would still have a name for types provided by the user, but id would be used for comparison.

That way we can prevent _ and __t1 from being the same type variable.

Implement syntax `fn` for complex functions

The arrow syntax for function types gets complicated with too many positional arguments.

It would be nice to support this more readable syntax:

(fn :from [...] :to ... :with ... :context ...)

and make the arrow function an alias for when there are no effects or context.

Ensure that scoping rules of the compiler & type checker are the same

Right now is too easy for the compiler to think that a variable is a primitive, but for the type checker to think it is a local variable instead.

Example:

(let ((:x 5))
  :x)

As of now (1ffcc66), the compiler will think the :x is an inline primitive. But the type checker will treat it as local variable.

A possible way to do this is to add a transformation phase to the AST before compiling/type checking where we do name resolution. Linking references to their definitions.

Implement external module system

Add a module id to each symbol: module:name. Modules can be implemented as extensions to the compiler. The basic method could be

  • lookupSymbol (name: string): JS.Expression

But more specific customizations like generating specific code for funcalls and others is possible.

Implement module system

Ability to compile multiple files.

Each file should have dependencies explicit so they can be processed in parallel, and only files that need changes. Store the output in a cache directory.

An argument for full extensible records with scoped labels

Currently, we do not implement delete on records in Delisp as it would imply keeping scoped labels at runtime.

I found an interesting problem today in JS/Typescript that scoped labels would help with.

I'll write the examples in JS.

Components

Consider you have a react-like web component which take some "props" as inputs.

For example,

function User (props) {
  // props.name
  // props.userId
}

is a component like this one would take as props name and userId.

High order components

Now, consider "high-order components" (HOC). That is, functions that transform a component into another one. A common use case of HOC is wrapping a component to take some extra properties. In this case, you may want to delete the custom labels from the record before you pass them through to the wrapped component. For instance:

function abTest (Component){
  return (props) => {
     const {currentVariation, ...innerProps} = props
     // do someting with currentVariation
     return <Component {...innerProps} />
  }
}

This HOC will take a component, and wraps it so it takes an additional currentVariation prop. This prop gets removed and the rest if forwarded to the inner component.

There is a problem though. What happens if your inner component takes a currentVariation component itself? Then the HOC component will remove it and the inner component will fail.

Scoped labels would allow the caller to pass currentVariation label both for the HOC and for the inner component if needed. Making abTest work for every component.

If this is probably something you want to warn against probably, it is still nice to be able to create abstractions that work for every component!

I may be missing something, but common practice like in this blog post

https://medium.com/@jrwebdev/react-higher-order-component-patterns-in-typescript-42278f7590fb

seems to suffer from this issue.

Create example app

Something simple like a todo app, either just backend code, or state-management related.

Variable arity / vector as function

The (vector 1 2 3) syntax was removed in cb49761 because it was equivalent (and equally powerful) as the [1 2 3] syntax.

If we have variable arity functions, it could make sense to implement vector again (but as a function, not a special syntax like before).

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.