Project

General

Profile

Design #294

BuiltInFunctions: General "OneLiner" for arguments of different type

Added by Anna Maria Bigatti about 11 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Normal
Category:
Parser/Interpreter
Target version:
Start date:
23 Jan 2013
Due date:
% Done:

100%

Estimated time:
2.00 h
Spent time:

Description

one liner functions work like a dream (thanks Giovanni! ;-)
Is it possible to simplify writing the code for overloaded functions?
E.g.
IsZero(RINGELEM/INT/RAT/...)

2014-08 conclusion: using switch with improved function names and behaviour (documented)


Related issues

Related to CoCoA-5 - Feature #306: Function for accessing the pointed valueClosed2013-02-12

Related to CoCoA-5 - Bug #524: BuiltInFunctions: remove calls to WrongTypeExceptionClosed2014-04-08

Related to CoCoA-5 - Feature #317: BuiltInFunctions: evalArgAsLongClosed2013-02-20

Related to CoCoA-5 - Design #525: BuiltInFunctions: evalArgAsT1OrT2, evalArgAsT1OrT2OrT3, ... last argumentClosed2014-04-08

Is duplicate of CoCoA-5 - Feature #284: BuiltInFunctions: more flexible typing in one-line function declarationClosed2012-12-05

History

#1 Updated by Anna Maria Bigatti about 11 years ago

Not quite the dream solution, but I found this function making life easier:
evalArgAsT1orT2orT3

int which;
intrusive_ptr<RightValue> v = runtimeEnv->evalArgAsT1orT2orT3<BigIntValue, BigRatValue, RingElemValue>(ARG(0), which);
....

#2 Updated by Anna Maria Bigatti about 11 years ago

added also evalArgAsT1orT2orT3orT4 and evalArgAsT1orT2orT3orT4orT5

#3 Updated by Anna Maria Bigatti about 10 years ago

  • Subject changed from General "OneLiner" for arguments of different type to BuiltInFunctions: General "OneLiner" for arguments of different type

#4 Updated by Anna Maria Bigatti almost 10 years ago

  • Status changed from New to Closed

#5 Updated by Anna Maria Bigatti almost 10 years ago

  • Status changed from Closed to In Progress
  • Target version changed from CoCoA-5.1.0 Easter14 to CoCoA-5.1.1 Seoul14

#6 Updated by Anna Maria Bigatti over 9 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 0 to 70
  • Estimated time set to 2.00 h

Is the new approach in BuiltInFunctions good enough?
I think so: it is not a one-liner but it's very readable (look for EvalArgAsT1Or..)

Close this issue?

#7 Updated by Anna Maria Bigatti over 9 years ago

  • Status changed from Resolved to Closed
  • Assignee set to Anna Maria Bigatti
  • % Done changed from 70 to 100

Also available in: Atom PDF