Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Executing an operations does not provide any ouput

Help
2013-06-11
2013-06-11
  • Rafael Campos
    Rafael Campos
    2013-06-11

    Hey there... thanks for the software first of all.

    Why is that when I defiene:

    class Reserva
    attributes
    n_reserva: Integer
    pagamento: EstadoPagamento
    operations
    pagar(): CartaoCredito
    begin
    result := self.cartaoCredito;
    end

    end --Reserva

    and then load the propor .use file and .soil fail and execute in the
    console "!@reserva1.pagar()" no output regarding to the return parameter
    is given? And what if I wanted to use this return in a query? Like
    "?@reserva1.pagar().numeroCartao" ?

    Thanks in advance.

     
  • You can capture the result in a variable

    ! x := @reserva1.pagar()

    In general, USE does not not allow to call imperatively defined operations inside queries, that is why

    ?@reserva1.pagar().numeroCartao

    does not work, since USE does not assume that pagar() is side-effect free.

    However, you can run USE with the switch -XsoilOpInOCL:ALL, then imperatively defined operations can be called as queries, too.