IoLanguage / io

Io programming language. Inspired by Self, Smalltalk and LISP.
http://iolanguage.org
Other
2.67k stars 298 forks source link

issue > call message arguments (list of numbers) #362

Closed KennethanCeyer closed 7 years ago

KennethanCeyer commented 7 years ago

hello there

my io version is

$ io --version
> Io Programming Language, v. 20110905

i'm using io language to make some library.

but i faced an issue that i haven't expected.

the below snippet describes my situation.

i don't understand why negative number is not caught at select receiver.

// 1. give spread parameters to someMethod
someObject someMethod(1, 2, 3, -1)

// 2. receive that parameters 
someMethod := method(
        numbers ::= call message arguments
        numbers println // output: list(1, 2, 3, -(1))

        // and now i want to check that list contains a negative number
        numbers select(number, number < 0) println // output: list()

        // i didn't expected, so check what's happend
        numbers select(number, (number < 0) println) // output: false \n false \n false \n false \n

        // hmm.. we need to get more information about this
        (-(1) < 0) println // output: true

        // perhaps..
        numbers select(number, (number asString asNumber < 0)) println // list(-(1))

       // wait... what!?
)
stevedekorte commented 7 years ago

call message arguments

returns message objects, not values. Try replacing it with:

call message argsEvaluatedIn(call sender)

KennethanCeyer commented 5 years ago

@stevedekorte So.. so much appreciated answering...

I finally can made a small library and a little extension

for your continuous and passionate maintaining.

https://github.com/KennethanCeyer/vscode-io-extension https://github.com/KennethanCeyer/hashids-io

And sorry for late checking