From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,WEIRD_QUOTING autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,951656122ecf7b3d,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-03-18 06:32:12 PST Path: archiver1.google.com!postnews2.google.com!not-for-mail From: evangeli@cnam.fr (Evangelista Sami) Newsgroups: comp.lang.ada Subject: pointer on an operator Date: 18 Mar 2004 06:32:10 -0800 Organization: http://groups.google.com Message-ID: <5f59677c.0403180632.7c338bf7@posting.google.com> NNTP-Posting-Host: 163.173.228.31 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1079620332 19334 127.0.0.1 (18 Mar 2004 14:32:12 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 18 Mar 2004 14:32:12 +0000 (UTC) Xref: archiver1.google.com comp.lang.ada:6405 Date: 2004-03-18T06:32:10-08:00 List-Id: hello i have declared this type : type bin_op is (plus_op, minus_op, div_op, mod_op, ...); i want to make a function which takes a bin_op two integers and return the result of the operation : function get_bin_op_result(op : bin_op; left, right : integer) return integer is begin case op is when plus_op => return left + right; when minus_op => return left - right; ... end case; end; to avoid this, is there a way to make a function which return an access to the right operator.like this : type operator_access is access function(I1, I2 : Integer) return Integer; function get_operator(op : in bin_op) is begin case op is when plus_op => return "+"'access; when minus_op => return "-"'access; ... end case; end; then the function simply becomes : function get_bin_op_result(op : bin_op; left, right : integer) return integer is begin return get_operator(op).all(left, right); end; i have tried this but the compilator complains on "when plus_op => return "+"'access;" : expressions.adb:299:17: expected type "Function_Access" defined at line 296 expressions.adb:299:17: found type access to ""+"" defined at line 29 is there a way to do this?