Всплытие переменных и функций в JavaScript
В JavaScript есть уникальная особенность, переменную или функцию можно использовать по коду выше, её объявление... Ииии что это за особенность?
Всплытие переменных и функций в JavaScript
В JavaScript есть уникальная особенность, переменную или функцию можно использовать по коду выше, её объявление... Ииии что это за особенность?
Tras explicar qúe son las constantes en Go y los tipos de datos que ofrece el lenguaje, llega el momento de unir ambos conceptos. En este artículo veremos cómo Go vincula constantes y tipos de datos.
Este articulo explica qué son las constantes en Go, cómo se declaran y en qué situaciones aportan claridad y seguridad al código.
Обзор утилиты TunerPro
TunerPRO это бесплатный бинарный редактор прошивок. Это аналог STM32Studio. Эта программа позволит вам редактировать константы в готовом bin файле. Минуя стадию повторной пере сборки всего проекта прошивки. Можно сказать, что TunerPRO хакерская tool-а. Эта утилита связывает в едино всю информацию про переменные. Это адрес ячейки памяти в bin-аре, размерность переменной, размер параметра, формат ее хранения в памяти, имя переменной, множитель, единицу измерения, максимальное и минимальное значение. В то время как map файл дает только инфу про имя адрес в памяти и размер.
https://habr.com/ru/articles/965828/
#TunerPro #STM32Studio #bin #xdf #Tuner_PRO #stm32 #const #volatile #volatile_const #flashпамять
И ещё немного про то, что const в dart надо ставить где попало
В статье рассказал про случай из реальной жизни, когда использование const и линтера на него помогли бы мне сэкономить полдня рабочего времени и сохранить нервы
関数スコープとブロックスコープ (PHPはなぜ var, let, const がない?アロー関数はブロックがない?)
https://qiita.com/Jim_Jin/items/8135b4e85b233ec34d13?utm_campaign=popular_items&utm_medium=feed&utm_source=popular_items
@katlyn generic as can be
it's still in theory & planning but i'd like to make something somewhere between a mix of Jai and Kotlin, essentially a quite low level language with a syntax more typical of a high level language.
There are a couple neat features that I plan on having, one is automatic callsite syntax variants for functions, where a function definition func(a, b) can be called in any supported syntax style; procedural (func(a, b)), OOP (a.func(b)), infix if it has exactly 2 arguments (a func b), etc.
Functions are first-class members (now that i've touched a language with it, I can't stand any language without it) and can appear in any place any other variable may appear
Here's a bit of sample for my ideas so far
//Syntax not final
numberOfBoops: Int = 1234 //Mutable variable declared and re-declared with = operator
numberOfBoops = 999999 //Cannot redeclare type
millionBoops = numberOfBoops + 1 //Type specification optional; when not specified, type will be inferred as narrowest type returned by expression (here, Int)
billionBoops: Int := 1000000000 //Immutable declarations use := operator
billionBoops = 1 //Compile error, cannot reassign immutable declaration
PI: Double #const := 3.14159265359 //'const' declarations may be optimized by compiler to inline at use-sites instead of appearing in heap memory
TAU #const := PI * 2.0 //Type is optional for all declarations; will be inferred as the narrowest type of the expression (here being a Double)
myCoolNumber: Int //uninitialized variable, must be initialized before appearing in any read position
main := () { /*statements*/ } //skeleton of function declaration syntax. No return type
getCoolNumber := () -> Int { return 420 } //function with return type
myCoolNumber = getCoolNumber() //initialize previously uninitialized variable, now it can be used
plus := (a: Int, b: Int) -> Int { a + b } //function with parameters and return type; 'return' may be omitted if last expression of function scope is of return type
myCoolerNumber := myCoolNumber plus 69 //infix call to 'plus'. Immutable declarations can be made from mutable expressions
myCoolestNumber: Int #const := myCoolerNumber + 1337 //Compile error, const declarations can only be constructed with literals and other const expressions
fold := <T, E>(elements: Iterable<E>, initial: T, op: (T, E) -> T) -> T { //function declaration with generic types T and E
accumulator = initial //Function parameters are always immutable, redeclare 'initial' with mutable variable
itr := elements.iterator() //function 'iterator := <E>(Iterable<E>) -> Iterator<E>' defined in Iterable class
while(itr.hasNext()) {
item := itr.next() //Immutable variables can be defined once per iteration of any scope ({}) so 'item' may be immutable here
accumulator = accumulator op item //Infix notation of 'op' function
}
return accumulator
}
sum := (values: Iterable<Int>)[fold, plus] -> Int { //optional brackets is a closure: if present, only variables in wider scope listed inside brackets may be referenced (here being the 'fold' and 'plus' function)
return values.fold(0, (acc, next){acc plus next}) //anonymous function provided as 'op' first-class function parameter to 'fold' function. Parameter types and return type inferred by 'fold' declaration
}
Theo on const vs let in #JavaScript:
https://youtu.be/dqmtzHB2zTM (32 min).
It's a long video, and he's basically only reacting to and commenting on Let me be https://www.epicweb.dev/talks/let-me-be (12 min) by Ryan Florence.
Theo's main point is that const doesn't mean "this value will never change" (since objects and arrays can obviously still be mutated), but that let means "pay attention, this value will be reassigned further down", and I totally agree.