MajeedKazemi / code-struct

A new text-based environment that helps beginners transition into conventional text-based programming environments.
http://code-struct.vercel.app
GNU General Public License v3.0
26 stars 10 forks source link

Draft Mode should give better suggestions for binary operators #547

Closed vicchig closed 2 years ago

vicchig commented 2 years ago

Ex. 123 + 'abc' will suggest that 'abc' is changed to an integer if it is added second and will suggest that 123 is changed to a string if it is added second.

What should be done instead is that the entire binary operator is highlighted (instead of one of the operands) and then we offer both fixes as an option.Although 'abc' cannot be converted to a number here.

MajeedKazemi commented 2 years ago

Thanks @vicchig. this would be amazing. do we have enough time to fix/add this?

vicchig commented 2 years ago

@MajeedKazemi

This is one of the additions we talked about in our meeting last week, right? It depends on whether the bugs take a while to fix or not. I would say that if I get to this by the end of this week then there should be enough time. I would make sure that all of the bugs are ironed out first though.

But it might be a bit too difficult to add now.

MajeedKazemi commented 2 years ago

We have time until Jan 10 (the day users start working with nova)

vicchig commented 2 years ago

This is only for operators that are defined for multiple types (for example the + operator works on both strings and integers). For operators that only support a single type, it should still highlight the operands individually because there is only a single type to convert them to. For example in (123 - 'abc') there is no option other than to convert 'abc' to a number (note that this is not even always possible).

vicchig commented 2 years ago

Related #530

vicchig commented 2 years ago

Implemented by #558 even though it is not a bug fix.