Is this a bug?

James Reeves <[email protected]> Thu, 1 Sep 2005 12:08:05 +0100
Newsgroups gmane.comp.lang.nice.general
Message-ID <[email protected]>
Hello,

I've come across what I think is a bug with nice syntax, but it might very 
well be me not understanding how Nice handles files. Before I report it as a 
bug, I thought I'd better check to first to see if it isn't a mistake on my 
part.

Essentially, a class B inheriting from a class A can access A's private 
methods, but only if class A is defined in the same file as class B. Is this 
deliberate? If so, is there anything akin to a "protected" keyword in Nice?

Steps to reproduce possible bug:

Create a directory "test"
Create a file "test/lib.nice"
---start---
class A {
 private String hello() = "hello world";
}
---end---

Create a file "test/main.nice"
---start---
class B extends A {
 void echo() {
  println(this.hello());
 }
}

void main(String[] args) {
 new B().echo();
}
---end---

Compile:
# nicec test
nice.lang: parsing
test: parsing

test/main.nice: line 3, column 30:
hello is not declared
compilation failed with 1 error

--
James Reeves


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf