RSSAmplifier

soc.me · Jul 10, 2022

Language Design: Useful Syntax Sugar

0
Sign in to vote or save

This page cannot be shown here. You can still read it on the original site — the toolbar below keeps your place in the directory.

get sugar Rule x.get(y) can be written as x(y) Explanation Instead of special-purpose syntax that is used for indexing operations (reading) in many languages, like int firstValue = someArray [ 0 ]; one can write let firstValue = someArray(0) /* same as */ let firstValue = someArray.get(0) assuming a definition like class Array[T] fun get(idx: Int64): T = ... In combination with varargs, it can…

Read on /languages/useful-syntax-sugar.html

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.