From c7956c27eb2674c9ee4c1f9657d890f329d98a4a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Thu, 28 Nov 2013 15:17:58 -0500 Subject: [PATCH] example: update and fix the extern_methods example MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The implementation of the method foo wrongfully called its C self. Signed-off-by: Alexis Laferrière --- examples/extern_methods.nit | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/extern_methods.nit b/examples/extern_methods.nit index 5941358..00c6b68 100644 --- a/examples/extern_methods.nit +++ b/examples/extern_methods.nit @@ -21,11 +21,11 @@ module extern_methods redef enum Int # Returns self'th fibonnaci number # implemented here in C for optimization purposes - fun fib : Int `{ + fun fib : Int import fib `{ if ( recv < 2 ) return recv; else - return Int_fib___impl( recv-1 ) + Int_fib___impl( recv-2 ); + return Int_fib( recv-1 ) + Int_fib( recv-2 ); `} # System call to sleep for "self" seconds @@ -43,8 +43,8 @@ redef enum Int # * the local fib method # * the + operator, a method of Int # * to_s, a method of all objects - # * String::to_cstring, a method of String to return an equivalent char* - fun foo import fib, +, to_s, String::to_cstring `{ + # * String.to_cstring, a method of String to return an equivalent char* + fun foo import fib, +, to_s, String.to_cstring `{ long recv_fib = Int_fib( recv ); long recv_plus_fib = Int__plus( recv, recv_fib ); -- 1.7.9.5