So I was looking up some basic tutorials for learning WebGL, and noticed that they all pass string representations of GLSL code blocks as parameters (such as this or this).
I looked through the documentation for WebGLRenderingContext, and sure enough, the source parameter description for the shaderSource method is:
A DOMString containing the GLSL source code to set.
I was always under the impression that this sort of thing was possible, but not a good coding practice.
Is this a deliberate design choice, or is there really no possible alternative offered by the other features of Javascript? (ie. a last resort option)
Does this occur in other languages as well, or should it generally be avoided?
EDIT: Mistook GLSL for Javascript