godot icon indicating copy to clipboard operation
godot copied to clipboard

Change is_valid_identifier() in ustring to be similar to is_valid_identifier() in text_server.

Open magian1127 opened this issue 1 year ago • 2 comments

Make it possible to use UTF in places like in the image below.

image

magian1127 avatar Nov 28 '22 13:11 magian1127

I'm not sure if it is a good idea to change is_valid_identifier(). Most likely there are other parts of the GDScript parser that will need to be changed (and if we decide to do it, it should use a proper implementation for TextServer).

The simple GDScript project here tested fine, but perhaps more complex testing is needed. The ultimate goal is to make GDScript also support UTF variables.(At present, C # is supported) But too many changes at once will lead to complicated problems, so first change this one method, and then give the rest to another PR.

这里简单的GDScript项目测试没有问题,或许还需要更多复杂的测试. 最终目标是希望让GDScript也能支持UTF变量.(目前C#是支持的.) 但是一次性改太多会导致问题复杂,所以先就改这个一个方法,其他的再交给另外的PR.

magian1127 avatar Nov 28 '22 14:11 magian1127

Many different places use this function and rely on it functioning as it does, there are a lot of places in code where this could cause errors

This would cause a lot of confusion for GDScript users, allowing them to create functions that aren't valid functions, it's also used by for example the global shader parameters, properties, visual shader, etc. etc.

AThousandShips avatar Nov 28 '22 14:11 AThousandShips

I would instead recommend adding a function to ScriptLanguage for getting valid identifiers and integrating that into this

AThousandShips avatar Nov 29 '22 09:11 AThousandShips