3

A note on how to improve the autodetection script for Go

 2 years ago
source link: https://www.codeabbey.com/index/forum_topic/404cdc065f62f1647b4455ee1b0bf403
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

A note on how to improve the autodetection script for Go

Back to General discussions forum

Rodion (admin)     2023-08-16 14:17:40
User avatar

Hi again! Curious that you thought of Go - actually there are a number of languages which are not detected... Though go is one of the most "promising" candidates, I myself switched to it from Java couple years ago :)))

Your snippet seems to be slightly malformed - after the second line there should be colon probably, or not there, I'm a bit slow to understand. Perhaps let's rewrite it with separate ifs (inside the outer one)?

Overall I support the idea! Perhaps it would be good even to set up some test-ground for variants of language detector. Wanted to try it with JsFiddle, but currently it won't open for me.

Rodion (admin)     2023-08-17 06:17:51
User avatar

Aha, thanks for confirmation!

I replaced the code as you suggested, and it looks like less or more working (also it attempts to improve recognition of C# and JS as I understand). However I dare say var is not very often found in Go code, mostly for global variables. Thus we may later come up with more improvements.

Perhaps the detection code needs general reworking in something more streamlined and flexible :) also the logic when detection happens may need improvement - for now it tries to decide when user entered only few lines, and this may lead to misidentifications...

Doing a few puzzles here already helped me.

Actually, struggling through it these two years, I found the language is mainly valued for "goroutines" and "channels" out of the box (most other languages include similar things only in form of heavy library methods) - and thus these "single-threaded" exercises may not be adequate to unveil these "main powers". Language itself is somewhat clumsy. Feel free to ping me when you get a bit tired of practicing syntax, so I can share some questions or puzzles on Go which I met in interviews.

oezguery     2023-08-17 07:56:47
User avatar

Good morning!

Go is indeed clumsy when it comes to solving puzzles. I enjoy learning in general and it is a great training to reach a goal under constraints.

When I come to more advanced stuff I will sure ping you. Right now I am learning the basics. Exercism is a good website for getting comments on the solutions from "mentors". I am making use of it to learn new concepts and improve my knowledge.

About the detection code, I cannot say much because I have experience with only a few languages.

Please login and solve 5 problems to be able to post at forum

</div


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK