I see. Seems current ob-core.el can filter out the `src-coderef`.
Like the following:
#+begin_src emacs-lisp
(prin1 "hello, world!") (ref:hello)
#+end_src
#+RESULTS[<2018-01-25 20:28:40> 16eccfedcc87d3ca0c7024b2637c646d4708ec42]:
: hello, world!
#+begin_src ruby :results output
puts "hello, world!" (ref:hello)
#+end_src
#+RESULTS[<2018-01-25 20:46:21> e1e8632ccedf7cc3c676be0c89841a885bbcc7d9]:
: hello, world!
But about your questions:
> What it the comment syntax is not properly defined?
I think almost all programming language has comments. About some other babels which don't have comment. I think `org-babel` can check whether babel language has comment.
> What if the coderef format already contains comment syntax?
`org-babel` already use current coderef format. Keep current coderef format is fine. If coderef format is like `#ref:label`. and Ruby language use comment `#` too. Then after prepending comment char, it becomes `# #ref:label`. It is fine. Right?
> What if the language does not support inline comments and you're in the middle of a line?
It is fine too. Current coderef already support insert coderef format at right align even I'm in the middle of a line. I tested.
All your questions solved.
My wanted feature is simple, just `(insert (concat comment-char coderef-format))`