GithubHelp home page GithubHelp logo

Comments (5)

mppf avatar mppf commented on August 16, 2024 2

The part I am not following is when these code patterns do emit an ambiguity error.

This does it:

record r { }
proc r.test() {
  var foo: int;
  proc r.foo { }
  foo;
}

Right. If it were proc foo then I would think it should be a redeclaration error; otherwise ambiguity. (But I wouldn't view a redeclaration error in this case as particularly bothersome; just conceptually it should be an ambiguity error because proc r.foo is adding something within record r which isn't in the same scope as var foo.

Except I'm realizing now that #25231 unintentionally changed this from an ambiguity error to a redeclaration error. I thought about that and had meant to avoid it, but I also don't know if it matters too much either way.

IMO it'd be reasonable to make an issue about the deficiency and move on to the next thing.

from chapel.

mppf avatar mppf commented on August 16, 2024 1

@riftEmber I'm not seeing that this is a dyno bug. On main with chpl, I am not seeing an ambiguity error in this case:

proc test(foo: int) {
  var foo: int; // this does not trigger an ambiguity error
  return foo;
}

var x = test(1);
writeln(x);

I think that we view the formals to be in a scope just outside of the function body. So var foo in this case is closer than the formal foo: int.

The part I am not following is when these code patterns do emit an ambiguity error.

from chapel.

riftEmber avatar riftEmber commented on August 16, 2024 1

Right. If it were proc foo then I would think it should be a redeclaration error; otherwise ambiguity. (But I wouldn't view a redeclaration error in this case as particularly bothersome; just conceptually it should be an ambiguity error because proc r.foo is adding something within record r which isn't in the same scope as var foo.

Okay, that makes sense.

IMO it'd be reasonable to make an issue about the deficiency and move on to the next thing.

Since I'm already warmed up on this I figured it would take about the same amount of time to just fix it as to make an issue, so I did: #25407

from chapel.

riftEmber avatar riftEmber commented on August 16, 2024

I'm not seeing that this is a dyno bug. On main with chpl, I am not seeing an ambiguity error in this case
I think that we view the formals to be in a scope just outside of the function body

Oh, whoops. I guess it's fine then.

The part I am not following is when these code patterns do emit an ambiguity error.

This does it:

record r { }
proc r.test() {
  var foo: int;
  proc r.foo { }
  foo;
}

Except I'm realizing now that #25231 unintentionally changed this from an ambiguity error to a redeclaration error. I thought about that and had meant to avoid it, but I also don't know if it matters too much either way.

from chapel.

riftEmber avatar riftEmber commented on August 16, 2024

Closing as not a bug

from chapel.

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.