View Ticket
String literals. [3fac68d49a]. check-in: fc3b105833 user: robin.hansen tags: trunk
12:41 Ticket [3fac68d49a] 0.3.0: Strings status still Open with 4 other changes artifact: 876791d343 user: robin.hansen
12:39 New ticket [3fac68d49a]. artifact: 3bef663d09 user: robin.hansen

Ticket UUID: 3fac68d49ad7c30bb97afca463efb1d4db047f6c
Title: 0.3.0: Strings
Status: Open Type: Language_Proposal
Severity: Important System: Compiler
Resolution: None Modified: 2021-08-16 12:41:27
User Comments:
robin.hansen added on 2021-08-16 12:39:53:

The following document outlines the language proposal process: Language Proposals


Strings... gotta have them.


  • Support string-literals, with the same escape sequences as other languages (\n, \\, etc.)
  • Support here-strings, to better represent documentation strings or string-dsl's like SQL and the like.
  • Add doc: keywords to modules, unions, structs, functions and multi-functions.
  • Add module to standard library with a minimal set of functions for manipulating strings


  • Add a Char type.
  • A most efficient implementation. This will require variable sized integers (8-bit integer).


Like most other languages, Strings will be delimited by ". In normal String literals, escape sequences like \n for newline, \t for tab and \\ for backslash work just like in other languages.

A String is "just" an Array of 32-bit Ints, where each Int represents a UTF-8 codepoint. This is inefficient, but will make the later transition to using 8-bit Ints very easy.

Stabel will also support here-strings which will work the same way as in Java. That is, escape sequences will not work (nothing is escaped) and the first level of indentation (determined by the first line) is removed. So the following:

	  this is the first line
	    this is the second line
	  finally, the third line

Will be equal to this:

	this is the first line
	  this is the second line
	finally, the third line

Here-strings is just syntactic sugar. Strings and here-strings are equal as far as the qualifier, type checker and code generator is concerned.

All current definitions (defmodule:, defstruct:, defunion:, def: and defmulti:) will support a doc: keyword to let people document their definitions. This might later be utilized by the repl and code documentation tools.

I'll add a string module to the standard library, based on what is currently available in Elm's core library.

Strings will not support template literals, as Arrays do, at least not in this first iteration.