Open orlandohill opened 7 years ago
Would be nice if the AST substrings are slices into the original string (char *, size_t)
, to improve memory-usage and performance.
Yes, makes sense.
Would the idea be to change AST_CHAR to AST_SPLICE, or to add AST_SPLICE as a new type? Something else entirely?
Yes, something like that.
Something like AST_CHARS
, containing a string_view
(naming matches C++
std::string_view
, alternative name: chars_view
):
typedef struct _string_view {
// Does not own the pointer
char *pointer;
size_t size;
} string_view;
Ideas for naming:
AST_CHARS_SLICE
AST_STRING_SLICE
AST_CHARS
The AST_CHAR
type would then be removed.
Sounds good. AST_CHARS
seems suitably short and descriptive.
Based on the in-progress Java version? Also see the new JavaScript version.