Giter Club home page Giter Club logo

Comments (15)

Electrux avatar Electrux commented on June 1, 2024

no it doesn't convert to string implicitly, to do that u will have to convert int to string first and then u can concat them.
to convert int to string, u can do the following:

5.to_str()

from ethereal.

CanadaHonk avatar CanadaHonk commented on June 1, 2024

Shouldn't it happen automatically though? At least most other langs do.

from ethereal.

CanadaHonk avatar CanadaHonk commented on June 1, 2024

Think it would be pretty easy to add the + operator in the str module. I can do it now if you want.

from ethereal.

CanadaHonk avatar CanadaHonk commented on June 1, 2024

Can't figure out how to do it lol. Leaving it for now.

from ethereal.

Electrux avatar Electrux commented on June 1, 2024

Well, it's ok. I shall perhaps do it. Although I do feel it to be not too useful

from ethereal.

Electrux avatar Electrux commented on June 1, 2024

to_str() converts any type to string so it should be just fine, although i can make a short hand style for it maybe.
how about something like...
str( /* anything */ )?

from ethereal.

CanadaHonk avatar CanadaHonk commented on June 1, 2024

Yeah maybe.

from ethereal.

CanadaHonk avatar CanadaHonk commented on June 1, 2024

Also I have a weird bug.

I have this script:

println( 'height: ' + term.height.to_str() );

But it errors out when I run it with:

mod_term.et 11[20]: error: function with name '+' and arg count 2 (str, str) does not exist
println( 'width: ' + term.width.to_str() );

from ethereal.

CanadaHonk avatar CanadaHonk commented on June 1, 2024

I reverted all my changes to do with operators and strings fyi.

from ethereal.

Electrux avatar Electrux commented on June 1, 2024

Did you import str;? Also, for println, you can just pass all arguments using comma separation instead of manually concatenating the strings.

from ethereal.

CanadaHonk avatar CanadaHonk commented on June 1, 2024

Oh haha, I didn't import it. Thanks for the tip as well.

from ethereal.

Electrux avatar Electrux commented on June 1, 2024

No problem :)
I wonder if I should just add the string concatenation, append, and comparison functions in the core module...

from ethereal.

CanadaHonk avatar CanadaHonk commented on June 1, 2024

Starting work on it again now.

from ethereal.

Electrux avatar Electrux commented on June 1, 2024

okay, good luck

from ethereal.

Electrux avatar Electrux commented on June 1, 2024

I think I will not let a string and any other type be added directly. This is because someone may accidentally concatenate two variables if they don't know one of them is string (which is entirely possible due to the dynamically typed nature of the language).
I shall consider more on this, but for now, I'll close this issue. Thanks! :)

from ethereal.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.