Genie does not support declaring generic functions with return values
Submitted by Jens Mühlenhoff
Link to original bug (#752365)
Description
From this stackoverflow question: http://stackoverflow.com/questions/31097190/what-is-the-syntax-for-generic-methods-in-genie
def get_length of T (val: T): int
if typeof(T) == typeof(string)
return ((string)val).length
else
pass
init
var s = "hello";
stdout.printf("%i", get_length of string (s))
The error message is:
generic_function.gs:3.16-3.17: error: syntax error, expected `(' but got `of' with previous identifier
def get_length of T (val: T): int
^^
Compilation failed: 1 error(s), 0 warning(s)
Edited by Rico Tzschichholz