I like to request some features to make YueScript easier to copy code and use with AI assistant code like ChatGPT and Github Copilot, Tabnine!

Ouverte
#152 21 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Évaluation

Difficulté
5/5
Temps estimé
Plus d'une semaine
Accessibilité débutants
20/100
Type d'issue
Fonctionnalité
Clarté
À clarifier
Activité
À l'abandon
Stack technique
lua
Domaine
compilers

Piste de recherche

Aucun fichier, test ou point d’entrée n’est indiqué. Traitez les six propositions de syntaxe comme des tâches de conception distinctes, en déterminant d’abord quelles demandes sont compatibles avec la syntaxe et le modèle de compilation existants de YueScript. Pour considérer le travail comme terminé, il faudrait avoir défini un périmètre convenu, documenté la syntaxe et ajouté des tests pour chaque fonctionnalité acceptée.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

Well...
I use YueScript daily to write tools and script games as a hobby, but I also work in other languages like Python, javascript, C# and GDScript as a dev. I extend use Github Copilot and sometime ChatGPT. The AI really helpful but they just keep suggest with Python or Lua code. It is a chore to convert them back to YueScript. It is the same when I want to 'borrow' codes online.

Then one idea pop into my mind, why not make YueScript more AI and copy friendly by support more Python, Lua or other lanagues common syntax, notation and make it easier to convert code to YueScript. I think it will be a great feature for YueScript and make it more popular.
Here are some I think will be helpful:

  1. Support create list like table with syntax: arr = []
    YueScript only support [] in list comprehension like Python. It is kind of a wasteful syntax and it is like a chore to must convert all [] => {}. Support [] make code look better, easier to see, AI Copilot friendly and easier to copy, convert from code of other languages like: Python, javascript, json, GDScript, etc.

  2. Support Lua table syntax: {key = val}
    It copies Lua's code table or accepts AI's suggested code without the need to edit it would be nice. And it is a nice style, even GDScript supports it then why won't YueScript support it?

  3. Support declare function style like: function myfunction(parm1, param2) or func myfunction(parm1, param2) or def myfunction(parm1, param2) would be nice.
    It is a common syntax in many languages like Python, Lua, GDScript, etc. It looks better than myfunction = () ->. Yuescript is very nice but I think that humans and AI prefer it more.

  4. I like to write yuescript to make some local tools to process my assets. My OS is Windows, I prefer to use YueScript/Lua over bat/cmd. It would be nice if YueScript supports more template string because "${exe} #{arg1} #{arg2}" is not good on Windows: exe ad arg1/arg2 can have space in the path and require quotes with '"'. It would be nice if YueScript supports raw template string like:

    os.execute [["#{exe}" "#{arg1}" "#{arg2}"]]  -- that maybe confilct with current yuescript raw string
    -- or adopt Python style raw string
      os.execute """
        "{exe}" "{arg1}" "{arg2}"
      """
    -- or adopt js style
      os.execute `"${exe}" "${arg1}" "${arg2}"`
    -- or just add support template to '' string as
      os.execute '"${exe}" "${arg1}" "${arg2}"'
    
  5. Add support 'var' keywords like javascript, GDScript: with feature hoisting as JavaScript's default behavior of moving declarations to the top of functions or global scope. It solves the problem of using a variable before it has been declared without need to use local *:

a = ->
  print "a"
  b!
b = ->
  print "b"
a!  -- attempt to call a nil value (global 'b')

It is the pain when writing utility scripts that have many functions and depend on each other

  1. Add 'elif' as 'elseif'. Well... I code a lot in python, so I make a lot of silly mistake like use 'elif' in Yue.

Thank you and regards!

Langage dominant
Lua
Étoiles
620
Forks
45
Merge moyen
9 h 5 min
PR mergées (30 j)
1

Préparer son environnement

Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de IppClub/YueScript

Toutes les issues de IppClub/YueScript

Issues similaires

Plus d'issues Lua

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.