Code Monkey home page Code Monkey logo

Comments (1)

James-Livesey avatar James-Livesey commented on September 26, 2024 2

This is an interesting behaviour of many BASICs, including BBC BASIC (which is one of the main BASICs I was considering when researching the mechanics of atto). See what happens in BBC BASIC:

BBC BASIC Keyword-Variable Conflict

The syntax highlighting of the bbcmic.ro editor demonstrates the conflict:
image

The main rationale behind this behaviour is to enable the ability to collapse spaces in code, making lines shorter (which is particularly useful for fitting code in Tweets to send to our Twitter bot).

I might consider preventing this behavour, though — I agree that it's a bit counter-intuitive in some situations! There might be a few issues with regards to backward compatibility, but to be honest, there aren't going to be many programs that will suffer from this issue.

There are cases in documentation where the reference to conflicting variable names has been avoided (eg. see pi - atto guide), so I have been aware about this problem for some time! I think that there's two things to think about before fixing this issue though — how frequent conflicting variable identifiers appear (eg. how many frequently-used variable names will start with rad or to?), and whether freedom will be lost in making projects that are designed to fit in a tight character space (eg. Twitter's 280 char limit).

Thankfully, keywords for constants don't cause conflicting variable names — not being able to start a variable name with e (Euler's number) would be frustrating to many! It could be possible to add some smart variable name vs keyword detection system, though behaviour might be hard to predict as a user.

Thanks for the issue, though. I'll have to have a think about it, and I'd love to know what others think about conflicting variables!

from atto.

Related Issues (20)

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.