import run::spawn_process;
import io::{ReaderUtil, WriterUtil};
import libc::{c_int, pid_t};
-import pipes::chan;
export run;
// This is a reinterpret_cast of a ~buffer, that can also be cast
// to a buffer_header if need be.
mut buffer: *libc::c_void,
+}
+
+fn PacketHeader() -> PacketHeader {
+ PacketHeader {
+ state: Empty,
+ blocked_task: ptr::null(),
+ buffer: ptr::null()
+ }
+}
+impl PacketHeader {
// Returns the old state.
unsafe fn mark_blocked(this: *rust_task) -> State {
rustrt::rust_task_ref(this);
}
}
-fn PacketHeader() -> PacketHeader {
- PacketHeader {
- state: Empty,
- blocked_task: ptr::null(),
- buffer: ptr::null()
- }
-}
-
#[doc(hidden)]
type Packet<T: Send> = {
header: PacketHeader,
// "none"
// } else { "some" }); }
}
+}
+
+fn SendPacketBuffered<T: Send, Tbuffer: Send>(p: *Packet<T>)
+ -> SendPacketBuffered<T, Tbuffer> {
+ //debug!("take send %?", p);
+ SendPacketBuffered {
+ p: Some(p),
+ buffer: unsafe {
+ Some(BufferResource(
+ get_buffer(ptr::addr_of((*p).header))))
+ }
+ }
+}
+
+impl<T: Send, Tbuffer: Send> SendPacketBuffered<T, Tbuffer> {
fn unwrap() -> *Packet<T> {
let mut p = None;
p <-> self.p;
}
}
-fn SendPacketBuffered<T: Send, Tbuffer: Send>(p: *Packet<T>)
- -> SendPacketBuffered<T, Tbuffer> {
- //debug!("take send %?", p);
- SendPacketBuffered {
- p: Some(p),
- buffer: unsafe {
- Some(BufferResource(
- get_buffer(ptr::addr_of((*p).header))))
- }
- }
-}
-
// XXX remove me
#[cfg(stage0)]
#[allow(non_camel_case_types)]
RecvPacket(p)
}
-struct RecvPacketBuffered<T: Send, Tbuffer: Send> : Selectable {
+struct RecvPacketBuffered<T: Send, Tbuffer: Send> {
mut p: Option<*Packet<T>>,
mut buffer: Option<BufferResource<Tbuffer>>,
drop {
// "none"
// } else { "some" }); }
}
+}
+
+impl<T: Send, Tbuffer: Send> RecvPacketBuffered<T, Tbuffer> : Selectable {
fn unwrap() -> *Packet<T> {
let mut p = None;
p <-> self.p;
}
}
+impl<T: Send> Port<T>: Selectable {
+ pure fn header() -> *PacketHeader unchecked {
+ match self.endp {
+ Some(endp) => endp.header(),
+ None => fail ~"peeking empty stream"
+ }
+ }
+}
+
/// Treat many ports as one.
-struct PortSet<T: Send> : Recv<T> {
+struct PortSet<T: Send> {
mut ports: ~[pipes::Port<T>],
+}
+
+fn PortSet<T: Send>() -> PortSet<T>{
+ PortSet {
+ ports: ~[]
+ }
+}
+
+impl<T: Send> PortSet<T> : Recv<T> {
fn add(+port: pipes::Port<T>) {
vec::push(self.ports, move port)
}
}
-fn PortSet<T: Send>() -> PortSet<T>{
- PortSet {
- ports: ~[]
- }
-}
-
-impl<T: Send> Port<T>: Selectable {
- pure fn header() -> *PacketHeader unchecked {
- match self.endp {
- Some(endp) => endp.header(),
- None => fail ~"peeking empty stream"
- }
- }
-}
-
/// A channel that can be shared between many senders.
type SharedChan<T: Send> = unsafe::Exclusive<Chan<T>>;
export DuplexStream;
/// An extension of `pipes::stream` that allows both sending and receiving.
-struct DuplexStream<T: Send, U: Send> : Channel<T>, Recv<U>, Selectable {
+struct DuplexStream<T: Send, U: Send> {
priv chan: Chan<T>,
priv port: Port <U>,
+}
+impl<T: Send, U: Send> DuplexStream<T, U> : Channel<T> {
fn send(+x: T) {
self.chan.send(x)
}
fn try_send(+x: T) -> bool {
self.chan.try_send(x)
}
+}
+impl<T: Send, U: Send> DuplexStream<T, U> : Recv<U> {
fn recv() -> U {
self.port.recv()
}
pure fn peek() -> bool {
self.port.peek()
}
+}
+impl<T: Send, U: Send> DuplexStream<T, U> : Selectable {
pure fn header() -> *pipes::PacketHeader {
self.port.header()
}
states: DVec<state>,
mut bounded: Option<bool>,
+}
+
+impl protocol_ {
/// Get a state.
fn get_state(name: ~str) -> state {
obsolete_set: hashmap<ObsoleteSyntax, ()>,
drop {} /* do not copy the parser; its state is tied to outside state */
+}
+impl parser {
fn bump() {
self.last_span = self.span;
let next = if self.buffer_start == self.buffer_end {
let obsolete_let = self.eat_obsolete_ident("let");
if obsolete_let { self.obsolete(copy self.last_span, ObsoleteLet) }
- if (obsolete_let || self.token_is_keyword(~"mut", copy self.token) ||
- !self.is_any_keyword(copy self.token)) &&
- !self.token_is_pound_or_doc_comment(self.token) {
- let a_var = self.parse_instance_var(vis);
- match self.token {
- token::SEMI => {
- self.obsolete(copy self.span, ObsoleteFieldTerminator);
- self.bump();
- }
- token::COMMA => {
- self.bump();
- }
- token::RBRACE => {}
- _ => {
- self.span_fatal(copy self.span,
- fmt!("expected `;`, `,`, or '}' but \
- found `%s`",
- token_to_str(self.reader,
- self.token)));
- }
- }
- return a_var;
- } else {
- let m = self.parse_method(vis);
- return @method_member(m);
+ let a_var = self.parse_instance_var(vis);
+ match self.token {
+ token::SEMI => {
+ self.obsolete(copy self.span, ObsoleteFieldTerminator);
+ self.bump();
+ }
+ token::COMMA => {
+ self.bump();
+ }
+ token::RBRACE => {}
+ _ => {
+ self.span_fatal(copy self.span,
+ fmt!("expected `;`, `,`, or '}' but \
+ found `%s`",
+ token_to_str(self.reader,
+ self.token)));
+ }
}
+ return a_var;
}
fn parse_dtor(attrs: ~[attribute]) -> class_contents {
session: session,
item_refs: hashmap<~str,&mut Option<def_id>>,
+}
+
+impl LanguageItemCollector {
fn match_and_collect_meta_item(item_def_id: def_id,
meta_item: meta_item) {
mut type_target: Option<Target>,
mut used: bool,
-
- fn target_for_namespace(namespace: Namespace) -> Option<Target> {
- match namespace {
- ModuleNS => return copy self.module_target,
- TypeNS => return copy self.type_target,
- ValueNS => return copy self.value_target
- }
- }
}
fn ImportResolution(span: span) -> ImportResolution {
}
}
+impl ImportResolution {
+ fn target_for_namespace(namespace: Namespace) -> Option<Target> {
+ match namespace {
+ ModuleNS => return copy self.module_target,
+ TypeNS => return copy self.type_target,
+ ValueNS => return copy self.value_target
+ }
+ }
+}
+
/// The link from a module up to its nearest parent node.
enum ParentLink {
NoParentLink,
// The index of the import we're resolving.
mut resolved_import_count: uint,
-
- fn all_imports_resolved() -> bool {
- return self.imports.len() == self.resolved_import_count;
- }
}
fn Module(parent_link: ParentLink, def_id: Option<def_id>) -> Module {
}
}
+impl Module {
+ fn all_imports_resolved() -> bool {
+ return self.imports.len() == self.resolved_import_count;
+ }
+}
+
// XXX: This is a workaround due to is_none in the standard library mistakenly
// requiring a T:copy.
mut module_span: Option<span>,
mut type_span: Option<span>,
mut value_span: Option<span>,
+}
+
+impl NameBindings {
/// Creates a new module in this set of name bindings.
fn define_module(parent_link: ParentLink, def_id: Option<def_id>,
/// Interns the names of the primitive types.
struct PrimitiveTypeTable {
primitive_types: hashmap<Atom,prim_ty>,
+}
+impl PrimitiveTypeTable {
fn intern(intr: ident_interner, string: @~str,
primitive_type: prim_ty) {
let atom = intr.intern(string);
export_map: ExportMap,
export_map2: ExportMap2,
trait_map: TraitMap,
+}
+
+impl Resolver {
/// The main name resolution procedure.
fn resolve(@self, this: @Resolver) {
candidate_impls: hashmap<def_id, ()>,
supplied_tps: ~[ty::t],
include_private: bool,
+}
+
+impl lookup {
// Entrypoint:
fn method() -> Option<method_map_entry> {
// implementations that are defined in the same scope as their base types.
privileged_implementations: hashmap<node_id,()>,
+}
+
+impl CoherenceChecker {
// Create a mapping containing a MethodInfo for every provided
// method in every trait.
how_hungry : int,
- fn speak() {}
}
+ impl cat {
+ fn speak() {}
+ }
fn cat(in_x : uint, in_y : int) -> cat {
cat {
meows: in_x,
}
how_hungry : int,
-
- fn speak() { self.meows += 1u; }
- fn meow_count() -> uint { self.meows }
-
}
+ impl cat {
+ fn speak() { self.meows += 1u; }
+ fn meow_count() -> uint { self.meows }
+ }
+
fn cat(in_x : uint, in_y : int) -> cat {
cat {
meows: in_x,
struct cat {
priv {
mut meows : uint,
- fn meow() {
- error!("Meow");
- self.meows += 1u;
- if self.meows % 5u == 0u {
- self.how_hungry += 1;
- }
- }
}
mut how_hungry : int,
name : ~str,
+}
+
+impl cat {
fn speak() { self.meow(); }
}
}
+ priv impl cat {
+ fn meow() {
+ error!("Meow");
+ self.meows += 1u;
+ if self.meows % 5u == 0u {
+ self.how_hungry += 1;
+ }
+ }
+ }
+
fn cat(in_x : uint, in_y : int, in_name: ~str) -> cat {
cat {
meows: in_x,
struct cat {
priv {
mut meows : uint,
- fn nap() { for uint::range(1u, 10000u) |_i|{}}
}
how_hungry : int,
}
+ impl cat {
+ priv fn nap() { for uint::range(1u, 10000u) |_i|{}}
+ }
+
fn cat(in_x : uint, in_y : int) -> cat {
cat {
meows: in_x,
}
how_hungry : int,
-
- fn speak<T>(stuff: ~[T]) {
- self.meows += stuff.len();
- }
- fn meow_count() -> uint { self.meows }
}
+ impl<U> cat<U> {
+ fn speak<T>(stuff: ~[T]) {
+ self.meows += stuff.len();
+ }
+ fn meow_count() -> uint { self.meows }
+ }
fn cat<U>(in_x : uint, in_y : int, -in_info: ~[U]) -> cat<U> {
cat {
mod kitty {
-struct cat : ToStr {
+struct cat {
priv {
mut meows : uint,
- fn meow() {
- error!("Meow");
- self.meows += 1u;
- if self.meows % 5u == 0u {
- self.how_hungry += 1;
- }
- }
}
mut how_hungry : int,
name : ~str,
+}
- fn speak() { self.meow(); }
-
- fn eat() -> bool {
- if self.how_hungry > 0 {
- error!("OM NOM NOM");
- self.how_hungry -= 2;
- return true;
+ impl cat : ToStr {
+ fn to_str() -> ~str { self.name }
}
- else {
- error!("Not hungry!");
- return false;
- }
- }
- fn to_str() -> ~str { self.name }
-}
+ priv impl cat {
+ fn meow() {
+ error!("Meow");
+ self.meows += 1u;
+ if self.meows % 5u == 0u {
+ self.how_hungry += 1;
+ }
+ }
+
+ }
+ impl cat {
+ fn speak() { self.meow(); }
+
+ fn eat() -> bool {
+ if self.how_hungry > 0 {
+ error!("OM NOM NOM");
+ self.how_hungry -= 2;
+ return true;
+ }
+ else {
+ error!("Not hungry!");
+ return false;
+ }
+ }
+ }
fn cat(in_x : uint, in_y : int, in_name: ~str) -> cat {
cat {
meows: in_x,
struct box<T> {
mut contents: Option<T>,
+}
+impl<T> box<T> {
fn swap(f: fn(+T) -> T) {
let mut tmp = None;
self.contents <-> tmp;
char::is_alphabetic(c) || char::is_digit(c) || c == '_'
}
-struct random_word_reader: word_reader {
+struct random_word_reader {
mut remaining: uint,
rng: rand::Rng,
+}
+impl random_word_reader: word_reader {
fn read_word() -> Option<~str> {
if self.remaining > 0 {
self.remaining -= 1;
}
how_hungry : int,
+}
+
+impl cat {
fn speak() { self.meows += 1u; }
}
fn speak();
}
-struct cat : noisy {
+struct cat {
priv {
mut meows : uint,
- fn meow() {
- error!("Meow");
- self.meows += 1u;
- if self.meows % 5u == 0u {
- self.how_hungry += 1;
- }
- }
}
mut how_hungry : int,
name : str,
+}
- fn speak() { self.meow(); }
+impl cat {
fn eat() -> bool {
if self.how_hungry > 0 {
}
}
+impl cat : noisy {
+ fn speak() { self.meow(); }
+
+}
+
+priv impl cat {
+ fn meow() {
+ error!("Meow");
+ self.meows += 1u;
+ if self.meows % 5u == 0u {
+ self.how_hungry += 1;
+ }
+ }
+}
+
fn cat(in_x : uint, in_y : int, in_name: str) -> cat {
cat {
meows: in_x,
struct cat {
priv {
mut meows : uint,
+ }
+}
+
+priv impl cat {
fn sleep() { loop{} }
fn meow() {
error!("Meow");
meows += 1u; //~ ERROR unresolved name
sleep(); //~ ERROR unresolved name
}
- }
}
+// xfail-test Resolve code for classes knew how to do this, impls don't
+
struct cat {
tail: int,
+}
+
+impl cat {
fn meow() { tail += 1; } //~ ERROR: Did you mean: `self.tail`
}
sock: int,
drop { }
+}
+
+impl socket {
fn set_identity() {
do closure {
struct siphash {
mut v0: u64,
+ }
+
+ impl siphash {
fn reset() {
self.v0 = k0 ^ 0x736f6d6570736575; //~ ERROR attempted dynamic environment-capture
//~^ ERROR unresolved name: k0
}
how_hungry : int,
+}
+impl cat {
fn eat() {
self.how_hungry -= 5;
}
// error-pattern:attempted access of field `nap` on type
// xfail-fast
+// xfail-test
// aux-build:cci_class_5.rs
use cci_class_5;
use cci_class_5::kitties::*;
-// error-pattern:call to private method not allowed
+// error-pattern:method `nap` is private
+
+mod kitties {
struct cat {
priv {
mut meows : uint,
- fn nap() { uint::range(1u, 10000u, |_i|{})}
}
how_hungry : int,
}
+impl cat {
+ priv fn nap() { uint::range(1u, 10000u, |_i| false)}
+}
+
fn cat(in_x : uint, in_y : int) -> cat {
cat {
meows: in_x,
how_hungry: in_y
}
}
+}
fn main() {
- let nyan : cat = cat(52u, 99);
+ let nyan : kitties::cat = kitties::cat(52u, 99);
nyan.nap();
}
struct dog {
mut cats_chased: uint,
+}
+impl dog {
fn chase_cat() {
let p: &static/mut uint = &mut self.cats_chased; //~ ERROR illegal borrow
*p += 1u;
struct dog {
mut food: uint,
+}
+impl dog {
fn chase_cat() {
for uint::range(0u, 10u) |_i| {
let p: &static/mut uint = &mut self.food; //~ ERROR illegal borrow
fn speak() -> int;
}
-struct dog : noisy {
+struct dog {
priv {
barks : @mut uint,
- fn bark() -> int {
+ }
+
+ volume : @mut int,
+}
+
+impl dog {
+ priv fn bark() -> int {
debug!("Woof %u %d", *self.barks, *self.volume);
*self.barks += 1u;
if *self.barks % 3u == 0u {
debug!("Grrr %u %d", *self.barks, *self.volume);
*self.volume
}
- }
-
- volume : @mut int,
+}
+impl dog : noisy {
fn speak() -> int { self.bark() }
}
}
}
-struct cat : noisy {
+struct cat {
priv {
meows : @mut uint,
+ }
+
+ how_hungry : @mut int,
+ name : ~str,
+}
+
+impl cat : noisy {
+ fn speak() -> int { self.meow() as int }
+}
+
+impl cat {
+ fn meow_count() -> uint { *self.meows }
+}
+
+priv impl cat {
fn meow() -> uint {
debug!("Meow");
*self.meows += 1u;
}
*self.meows
}
- }
-
- how_hungry : @mut int,
- name : ~str,
-
- fn speak() -> int { self.meow() as int }
- fn meow_count() -> uint { *self.meows }
}
fn cat(in_x : uint, in_y : int, in_name: ~str) -> cat {
fn speak();
}
-struct cat : noisy {
+struct cat {
priv {
mut meows : uint,
- fn meow() {
- error!("Meow");
- self.meows += 1u;
- if self.meows % 5u == 0u {
- self.how_hungry += 1;
- }
- }
}
mut how_hungry : int,
name : ~str,
+}
+impl cat : noisy {
fn speak() { self.meow(); }
+}
+impl cat {
fn eat() -> bool {
if self.how_hungry > 0 {
error!("OM NOM NOM");
}
}
+priv impl cat {
+ fn meow() {
+ error!("Meow");
+ self.meows += 1u;
+ if self.meows % 5u == 0u {
+ self.how_hungry += 1;
+ }
+ }
+}
+
fn cat(in_x : uint, in_y : int, in_name: ~str) -> cat {
cat {
meows: in_x,
struct cat {
meows: uint,
name: ~str,
+ }
+ impl cat {
fn get_name() -> ~str { self.name }
}
// for any int value that's less than the meows field
// ok: T should be in scope when resolving the trait ref for map
-struct cat<T: Copy> : map<int, T> {
+struct cat<T: Copy> {
priv {
// Yes, you can have negative meows
mut meows : int,
- fn meow() {
- self.meows += 1;
- error!("Meow %d", self.meows);
- if self.meows % 5 == 0 {
- self.how_hungry += 1;
- }
- }
}
mut how_hungry : int,
name : T,
+}
+impl<T: Copy> cat<T> {
fn speak() { self.meow(); }
fn eat() -> bool {
return false;
}
}
+}
+impl<T: Copy> cat<T> : map<int, T> {
pure fn size() -> uint { self.meows as uint }
fn insert(+k: int, +_v: T) -> bool {
self.meows += k;
fn clear() { }
}
+priv impl<T: Copy> cat<T> {
+ fn meow() {
+ self.meows += 1;
+ error!("Meow %d", self.meows);
+ if self.meows % 5 == 0 {
+ self.how_hungry += 1;
+ }
+ }
+}
+
fn cat<T: Copy>(in_x : int, in_y : int, in_name: T) -> cat<T> {
cat {
meows: in_x,
use cci_class_trait;
use cci_class_trait::animals::*;
-struct cat : noisy {
+struct cat {
priv {
mut meows : uint,
- fn meow() {
- error!("Meow");
- self.meows += 1u;
- if self.meows % 5u == 0u {
- self.how_hungry += 1;
- }
- }
}
mut how_hungry : int,
name : ~str,
+}
- fn speak() { self.meow(); }
-
+impl cat {
fn eat() -> bool {
if self.how_hungry > 0 {
error!("OM NOM NOM");
}
}
+impl cat : noisy {
+
+ fn speak() { self.meow(); }
+
+}
+
+priv impl cat {
+ fn meow() {
+ error!("Meow");
+ self.meows += 1u;
+ if self.meows % 5u == 0u {
+ self.how_hungry += 1;
+ }
+ }
+}
+
fn cat(in_x : uint, in_y : int, in_name: ~str) -> cat {
cat {
meows: in_x,
fn speak();
}
-struct cat : noisy {
+struct cat {
priv {
mut meows : uint,
+ }
+
+ mut how_hungry : int,
+ name : ~str,
+}
+
+priv impl cat {
fn meow() {
error!("Meow");
self.meows += 1u;
self.how_hungry += 1;
}
}
- }
-
- mut how_hungry : int,
- name : ~str,
-
- fn speak() { self.meow(); }
+}
+impl cat {
fn eat() -> bool {
if self.how_hungry > 0 {
error!("OM NOM NOM");
}
}
+impl cat : noisy {
+ fn speak() { self.meow(); }
+}
+
fn cat(in_x : uint, in_y : int, in_name: ~str) -> cat {
cat {
meows: in_x,
}
how_hungry : int,
+}
+
+impl cat {
fn speak() { self.meows += 1u; }
fn meow_count() -> uint { self.meows }
}
how_hungry : int,
+}
+impl<U> cat<U> {
fn speak<T>(stuff: ~[T]) {
self.meows += stuff.len();
}
struct cat {
priv {
mut meows : uint,
- fn meow() {
- error!("Meow");
- self.meows += 1u;
- if self.meows % 5u == 0u {
- self.how_hungry += 1;
- }
- }
}
mut how_hungry : int,
name : ~str,
+}
+
+impl cat {
fn speak() { self.meow(); }
}
}
+priv impl cat {
+ fn meow() {
+ error!("Meow");
+ self.meows += 1u;
+ if self.meows % 5u == 0u {
+ self.how_hungry += 1;
+ }
+ }
+}
+
fn cat(in_x : uint, in_y : int, in_name: ~str) -> cat {
cat {
meows: in_x,
}
how_hungry : int,
+}
+impl<U> cat<U> {
fn speak() {
self.meows += 1u;
}
}
how_hungry : int,
+}
+impl cat {
fn speak() {}
}
struct cat {
priv {
mut meows : uint,
- fn meow() {
- error!("Meow");
- self.meows += 1u;
- if self.meows % 5u == 0u {
- self.how_hungry += 1;
- }
- }
}
mut how_hungry : int,
name : ~str,
+}
+
+impl cat {
fn speak() { self.meow(); }
}
}
+priv impl cat {
+ fn meow() {
+ error!("Meow");
+ self.meows += 1u;
+ if self.meows % 5u == 0u {
+ self.how_hungry += 1;
+ }
+ }
+}
+
fn cat(in_x : uint, in_y : int, in_name: ~str) -> cat {
cat {
meows: in_x,
trait clam<A: Copy> {
fn chowder(y: A);
}
-struct foo<A: Copy> : clam<A> {
+struct foo<A: Copy> {
x: A,
+}
+
+impl<A: Copy> foo<A> : clam<A> {
fn chowder(y: A) {
}
}
trait clam<A: Copy> { }
struct foo<A: Copy> {
x: A,
+}
+
+impl<A: Copy> foo<A> {
fn bar<B,C:clam<A>>(c: C) -> B {
fail;
}
struct c1<T: Copy> {
x: T,
+}
+
+impl<T: Copy> c1<T> {
fn f1(x: int) {
}
}
struct c1<T: Copy> {
x: T,
+}
+
+impl<T: Copy> c1<T> {
fn f1(x: T) {}
}
sock: int,
drop { }
+}
+
+impl socket {
fn set_identity() {
do closure {
struct font {
fontbuf: &self/~[u8],
+}
+impl font {
fn buf() -> &self/~[u8] {
self.fontbuf
}
sender_terminate(option::unwrap(p))
}
}
+ }
+
+ impl<T: Send> send_packet<T> {
fn unwrap() -> *packet<T> {
let mut p = None;
p <-> self.p;
receiver_terminate(option::unwrap(p))
}
}
+ }
+
+ impl<T: Send> recv_packet<T> {
fn unwrap() -> *packet<T> {
let mut p = None;
p <-> self.p;
b.get_bar()
}
-struct cbar : bar<int> {
+struct cbar {
x: int,
+}
+
+impl cbar : bar<int> {
fn get_bar() -> int {
self.x
}
struct b {
i: int,
+ }
+
+ impl b {
fn do_stuff() -> int { return 37; }
}
}
how_hungry : int,
+}
+impl cat {
fn meow_count() -> uint { self.meows }
}
struct cat {
priv {
mut meows : uint,
- fn nap() { for uint::range(1u, 10u) |_i| { }}
}
how_hungry : int,
+}
+impl cat {
fn play() {
self.meows += 1u;
self.nap();
}
}
+priv impl cat {
+ fn nap() { for uint::range(1u, 10u) |_i| { }}
+}
+
fn cat(in_x : uint, in_y : int) -> cat {
cat {
meows: in_x,
struct shrinky_pointer {
i: @@mut int,
- fn look_at() -> int { return **(self.i); }
drop { log(error, ~"Hello!"); **(self.i) -= 1; }
}
+impl shrinky_pointer {
+ fn look_at() -> int { return **(self.i); }
+}
+
fn shrinky_pointer(i: @@mut int) -> shrinky_pointer {
shrinky_pointer {
i: i
use std;
use pipes::send;
-use pipes::chan;
+use pipes::Chan;
use pipes::recv;
fn main() { test00(); }