Skip to main content

This is my blog, more about me at marianoguerra.github.io

🦋 @marianoguerra.org 🐘 @marianoguerra@hachyderm.io 🐦 @warianoguerra

Rust, un lenguaje interesante

pocos lenguajes me llaman la atención rápido y en pocas palabras, de los que puedo enumerar que me llamaron la atención de una forma u otra son: erlang (por el manejo de inmutabilidad, concurrencia y tolerancia a fallos), limbo (por los channels), go (porque es limbo pero mas marketinero), haskell (porque es haskell, lazy evaluation, inferencia de tipos, funcional puro, currying y un largo etc.) y el mas nuevo en llamarme la atención es Rust, un lenguaje bastante alpha desarrollado por mozilla.

del manual rescato algunas cosas que me parecieron interesantes.

http://cloud.github.com/downloads/graydon/rust/rust-2010-07-08-snap.pdf

No null pointers

The initialization state of every slot is statically computed as part of the typestate
system (see below), and requires that all slots are initialized before use. There is nonull value; uninitialized slots are uninitialized, and can only be written to, not read.


si no esta inicializada te da error de compilacion, no podes leer de la variable si no la inicializaste. asi de simple :D

Lightweight tasks with no shared mutable state

Like many actor languages, Rust provides an isolation (and concurrency) model based on lightweight tasks scheduled by the language runtime. These tasks are very inexpensive and statically unable to mutate one another’s local memory. Breaking the rule of task isolation is only possible by calling external (C/C++) code.
Inter-task communication is typed, asynchronous and simplex, based on passing messages over channels to ports.


te suena de otro lenguaje? ;)

State values can refer to non-state values, but not vice-versa. Rust therefore encourages the programmer to write in a style that consists primarily of immutable types, but also permits limited, local (per-task) mutability.

Structural types may be pattern-matched in an alt statement.

Rust provides a mechanism of partially binding arguments to functions, producing new functions that accept the remaining un-bound arguments. This mechanism combines some of the features of lexical closures with some of the features of currying, in a smaller and simpler package.

Rust supports local type inference:

signatures of functions, objects and iterators always require type annotation, but within the body of a function or iterator many slots can be declared auto and Rust will infer the slot’s type from its uses.

Rust has a lightweight object system based on structural object types: there is no “class hierarchy” nor any concept of inheritance.


parecido a go...

Method overriding and object restriction are performed explicitly on object values, which are little more than order-insensitive records of methods sharing a common private value.

Rust includes support for values of a top type, any, that can hold any type of value whatsoever. An any value is a pair of a type code and a boxed value of that type.

Injection into an any and projection by type-case-selection is integrated into the language.

Rust supports a system for syntactic extensions that can be loaded into the compiler, to implement user-defined notations, macros, program-generators and the like.

Rust has a system for propagating task-failures and other spontaneous events between tasks. Some signals can be trapped and redirected to channels; other signals are fatal and result in task-failure. Tasks can designate other tasks to handle signals for them.
This permits organizing tasks into mutually-supervising or mutually-failing groups.

bastante erlangoso :P

Dentro de las influencias nombra a Joe Armstrong



veremos para donde dispara este lenguaje, espero que le vaya bien.