Giter Site home page Giter Site logo

Code restructuring about euwren HOT 2 CLOSED

liquidev avatar liquidev commented on May 27, 2024
Code restructuring

from euwren.

Comments (2)

liquidev avatar liquidev commented on May 27, 2024

Maybe the intermediate structure idea isn't going to pass, but as a first effort the following can be done:

  • make every class foreign,
  • remove constructors and replace them entirely with static methods,
  • remove destructors and let ref object finalizer handle everything.

I'm also thinking about changing the syntax of foreign() to be a lot more clean and readable:

wren.foreign("module"):
  Greeter:
    # regular procs would work as usual
    greet
    # * would declare a static proc
    *newGreeter -> new
    # ? would declare a getter
    ?greeting
    # *? or ?* would declare a static getter
    *?world

This would solve issues #4 and #10, which I'm unable to solve with the current DSL.

Why is it more readable? I always find things that are right below each other, with little to no column variation much easier to read. Consider this:

wren.foreign("module"):
  Greeter:
    greet
    [new] newGreeter -> new
    [get] greeting
    [genStatic, get] world

versus the above example:

wren.foreign("module"):
  Greeter:
    greet
    *newGreeter -> new
    ?greeting
    *?world

As one can see, the sudden jumps between columns in the first example make reading harder. You don't see what's bound, you see how it's bound, and that doesn't aid readability (users should see what they bind first and foremost). It may seem more readable at first, but ultimately some limitations of Nim identifiers cannot be overcome (keywords are a PITA).

from euwren.

liquidev avatar liquidev commented on May 27, 2024

Fixed in 0.11.0.

from euwren.

Related Issues (16)

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.