Git Product home page Git Product logo

Comments (3)

gewang avatar gewang commented on July 17, 2024

more thinking from PR Lab hackathon edition @nshaheed @AndrewAday @gewang
5. disallow time via run-time time police
6. possibly disallow all function calls (except for constructors of static variable being declared
7. OR use dependency system to sort it out

class X
{
    fun static int go() { <<< "go" >>>; return 1; }
}

X x;

class Y
{
    fun Y(float val)
    {
        X.go(); // this should be okay
        x.go(); // this would not be okay, due to dependency
        <<< val >>>;
    }
}

class Z
{
    fun int nooooo() { return 2; }
    
    // this probably can't work, as static init happens
    // after compile but before run code
    x.go() => static int z;
    
    // calling a member function is not allowed
    nooooo() => static int a;

    // this is okay because it would just be part of pre-ctor    
    nooooo() => a;
    
    // constructor
    // could throw runtime exception if time-advance detect
    // compile time if dependencies don't work out
    // this line needs to be marked as being run before this file
    // need to generate a VM-code-block to run static stuff immediate
    // after compile, before file code is run
    static Y why(440);
}

from chuck.

nshaheed avatar nshaheed commented on July 17, 2024

Java allows static function calls and constructors in static variable declarations, but not member functions. Static variables can also be modified in static functions,

public class MyClass {
    static int p = 0;
    static MyClass fajioe = new MyClass();
    public static void main(String args[]) {
      int x=10;
      int y=25;
      int z=x+y;

      System.out.println("Sum of x+y = " + z);
    }
    
    public static int test() {
        
        System.out.println("jfioesjfioe");
        System.out.println(p);
        return 11;
    }
    
    public static int foo = test();
    
    public MyClass() {
        System.out.println("ssssss");
        p = 4;
    }
}

from chuck.

gewang avatar gewang commented on July 17, 2024

for class static UGen connect or constructors in general, detect for time-advance and throw exception if detected

class DEELAY extends UGen
{
    fun DEELAY()
    {
        2::second => now;
        <<< "constructor" >>>;
    }
}

DEELAY dl => dac;

<<< "after connect" >>>;

from chuck.

Related Issues (20)

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.