Giter VIP home page Giter VIP logo

Comments (1)

gewang avatar gewang commented on July 19, 2024

resolved of 1.5.0.8 with detection and multiple error reporting

chuck/VERSIONS

Lines 334 to 376 in cbe2c06

- (added) error checking for out-of-order dependency issues where
a function is called (or a class instantiated) that would skip
a neede variable initialization; this addresses a long-standing
issue that has caused much confusion because previously the issue
failed but silently.
---
For example, consider this 'foobar.ck' code
```
// does not work here: precedes 'bar' initialization
foo();
// where 'bar' initializes
5 => int bar;
// FYI calling foo() works here: after 'bar' initializes
// foo();
// the function definition
fun void foo()
{
// needs 'bar' to be initialized
<<< "bar:", bar >>>;
}
```
The new resulting compiler error:
```
> chuck foobar.ck
foobar.ck:4:1: error: calling 'foo()' at this point skips
initialization of a needed variable:
[4] foo();
^
foobar.ck:7:10: error: ...(note: this skipped variable
initialization is needed by 'fun void foo()')
[7] 5 => int bar;
^
foobar.ck:16:17: error: ...(note: this is where the variable
is used within 'fun void foo()')
[16] <<< "bar:", bar >>>;
^
error-depend-var.ck: ...(hint: try calling 'foo()' after the
variable initialization)
```
---
Similar errors are reported for class definitions that reference
file-top-level variables, etc.

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.