1 JavaScriptが悪い理由
•1.1貧弱なデザイン
•1.2タイプシステム
•1.3悪い機能
•1.4欠落している機能
•1.5 DOM
2 Luaが吸う理由
3 PHPが吸い込まれる理由
•3.1現在サポートされているバージョンで修正
4 Perl 5が吸い込まれる理由
5 Pythonが吸い込まれる理由
•Python 3で修正された5.1
6 Rubyが吸う理由
7 Flex / ActionScriptが吸い込まれる理由
8スクリプト言語が悪い理由
9 Cが吸う理由
10 C ++が吸う理由
11 .NETが吸い込む理由
12なぜC#が吸うのか
13 VB.NETが吸い込まれる理由
15 Objective-Cが吸う理由
16 Javaが吸い込まれる理由
•16.1構文
•16.2 Java 7(2011)で修正
•16.3モデル
•16.4ライブラリ
•16.5ディスカッション
17 Backbaseが吸う理由
18 XMLが吸い込まれる理由
19なぜXSLT / XPathが嫌いなのか
20 CSSが吸い込まれる理由
•CSS3で修正された20.1
21 Scalaが吸う理由
22なぜHaskellが吸うのか
23閉鎖が吸い込まれる理由
24なぜ吸うのか
•24.1基本プログラミングツール(基本言語)
•24.2相互運用性
•24.3標準ライブラリ
•24.4ツールキット
•24.5コミュニティ
25錆が吸う理由
•25.1セキュリティ
•25.2構文
•25.3 APIの設計と型システム
•25.4コミュニティ
•25.5ツールキット
JavaScriptが悪い理由
一部の規定はJavaScript自体には適用されず、Webアプリケーションプログラミングインターフェイス(
https://developer.mozilla.org/en/docs/Web/API )に適用されることに注意してください。
貧弱なデザイン
• , .
• Camel- :
XMLHttpRequest
HTMLHRElement
• "+" . , :
var i = 1;
//
i = i + ""; // !
// -
i + 1; // "11"
i - 1; // 0
• + , += 1 ++. :
var j = "1";
j++; // j 2
var k = "1";
k += 1; // k "11"
[1,5,20,10].sort() // [1, 10, 20, 5]
• var , , . let.
• JavaScript . .
• - . . ( ES6).
• JavaScript: , , , , « » « ». - , . ( ES6 ).
• JavaScript . , __proto__, . ( Object.create(null) ES5 Map ES6).
• . , ( Array.from ES6):
var args = Array.prototype.slice.call(arguments);
( ).
• .
0.1 + 0.2 === 0.30000000000000004;
, , . .
http://www.math.umd.edu/~jkolesar/mait613/floating_point_math.pdf.
• NaN , .
typeof NaN === "number"
// , NaN
NaN != NaN
NaN !== NaN
// , "" "NaN".
x !== x
// -
isNaN(x)
, IEEE754. IEEE754 .
• (null) , typeof null === 'object'.
( ,
http://www.jslint.com/)
• JavaScript C, .. - ++ --. . « » .
• JavaScript Perl.
• «this» («») , :
// "This"
object.property = function foo() {
return this; // "This" , ()
}
// "This"
var functionVariable = function foo() {
return this; // "This"
}
// "This"
function ExampleObject() {
this.someNewProperty = bar; // "This"
this.confusing = true;
}
// "This"
function doSomething(somethingHandler, args) {
somethingHandler.apply(this, args); // "this" , ""
this.foo = bar; // "This" ""
var that = this;
// , "this"
someVar.onEvent = function () {
that.confusing = true;
// "this" someVar
}
}
•
// "This"
return
{
a: 5
};
• , . , . .
// "This"
return
{
'a': 5
};
• :
function bar() {
// -, var,
foo = 5;
}
( «use strict» (« ») ES5.)
• == , , , . === , , .
0 == ""
0 == "0"
0 == " \t\r\n "
"0" == false
null == undefined
"" != "0"
false != "false"
false != undefined
false != null
• :
new Function("x", "y", "return x + y");
new Array(1, 2, 3, 4, 5);
new Object({"a": 5});
new Boolean(true);
• parseInt , , , 10:
parseInt("72", 10);
Number('72') .
• «with» ( ) , .
with (obj) {
foo = 1;
bar = 2;
}
• «for in» , , object.hasOwnProperty(name) Object.keys(...).forEach(...).
for (var name in object) {
if (object.hasOwnProperty(name)) {
/* ... */
}
}
//
Object.keys(object).forEach(function() { ... });
• , , ; «for in» , , ( , .. parseInt ).
var n = 0;
for (var i in [3, 'hello world', false, 1.5]) {
i = parseInt(i); //
alert(i + n);
}
//
[3, 'hello world', false, 1.5].map(Number).forEach(function() { alert(i + n) });
• () (.
https://developer.mozilla.org/en/JavaScript/Reference/Deprecated_Features), getYear setYear Date.
• ES6, . JavaScript — , Object.freeze(...).
//
const pi = 3.14159265358;
const msg = "Hello World";
//
const bar = {"a": 5, "b": 6};
const foo = [1, 2, 3, 4, 5];
//
const func = function() {
const x = arguments[0], y = arguments[1];
return x + y;
};
• , , , . (ES6 ).
ES6
x -> x * x
• , Math.pow , **, . ( ES6 **)
Math.pow(7, 2); // 49
• . , - , , .
DOM ( )
• Firefox, Internet Explorer, Opera, Google Chrome, Safari, Konqueror .. DOM .
• , alert(), , , .
//
function doNothingWithEvent(event) {
return true;
}
//
function doNothingWithEvent(event) {
alert('screwing everything up');
return true;
}
Lua
• , .
do
local realVar = "foo"
real_var = "bar" -- Oops
end
print(realVar, real_var) -- nil, "bar"
• . Lua , , .
• vararg ( ) , .
local function fn() return "bar", "baz" end
print("foo", fn()) -- foo bar baz
print("foo", fn(), "qux") -- foo bar qux
• vararg ( ) (
...
).
• varargs ( ) .
• varargs ( ).
• varargs ( ) .
• varargs , , , varargs, , , , \0 C-.
• . , 0, .
•
break
,
do while
(
while (something) do
,
repeat something until something
)
goto
,
continue
. .
• , :
>2+2
stdin:1: unexpected symbol near '2'
>return 2+2
4
• Lua , PCRE.
• . , , , __index-.
• . «» Lua .
• . , — , , . .
>("string"):upper()
STRING ()
>({1,2,3}):concat()
stdin:1: attempt to call method 'concat' (a nil value)
>(3.14):floor()
stdin:1: attempt to index a number value
PHP
•
'0'
,
0
0.0
,
'0.0'
— .
•
.
• - , . , , : :
• doc- "<<<END"
PHP < 5.3.
• . , php4.x, php5, php5.1…
• . ( ) , — (, , ):
$x = Array();
$y = array();
$x == $y; # is true
$x = 1;
$X = 1;
$x == $X; # is true
• , , «nonexistent_constant_name». .
• , , , ; .
• , (. func_get_args()
).
• , ; , .
•
Array()
- .
• «-» — . - — . :
$arr[2] = 2;
$arr[1] = 1;
$arr[0] = 0;
foreach ($arr as $elem) { echo "$elem "; } // "2 1 0"!!
• .
•
"use strict"
.
• POSIX STRFTIME(3) .
• :
error_log("Frobulating $net->ipv4->ip");
Frobulating Object id #5->ip
$foo = $net->ipv4;
error_log("Frobulating $foo->ip");
Frobulating 192.168.1.1
:
error_log("Frobulating {$net->ipv4->ip}");
• : // #.
•
<?php
?>
, HTML , .
• :
float
double
.
• , , , , , PHP 5.4 ( PHP 7).
•
(float)
.
• . , , .. ,
array_diff
,
array_reverse
.. ; , + (- ). ? :
$a.diff($b)
,
$a.reverse()
.
• PHP C Perl, , , -. , .
• : —
array_reverse
shuffle
— .
• «needle, haystack», — «haystack, needle».
• , .
• :
$$a[1]
${$a[1]}
${$a}[1]
,
$a[1]
$aa
.
• , , . , , , .
• : () , , , ( PHP 7).
•
$
, , — , — , .
•
!
,
=
, —
if (!$a = foo())
— «» !
• 32- 64- (
<< >> <<= >>=
) 32 .
• ( ) , .
• «».
•
and
or
,
&&
||
, .
• ,
:
endif;
,
endwhile;
,
endfor;
endforeach
.
•
(int)
(integer)
, —
(bool)
(boolean)
, —
(float)
,
(double)
(real)
.
• , .
• PHP5 — , , , ( ).
• , , , , .
• .
• - , ,
include
FALSE
.
• - , require()
.
• , , : .
• , , , :
function makeyogurt($type = "acidophilus", $flavour)
{
return "Making a bowl of $type $flavour.\n";
}
echo makeyogurt("raspberry"); // " ". .
• (PHP 4) (
$this
) (
self
).
• , ,
unserialize()
,
__PHP_Incomplete_Class
, .
• foreach, , .
• , self:: __CLASS__, , ( PHP >= 5.3 static::):
class A {
public static function who() {
echo __CLASS__;
}
public static function test() {
self::who();
}
}
class B extends A {
public static function who() {
echo __CLASS__;
}
}
B::test(); // A, B!
• (, ) .
class a {
function nextFoo() {
class b {} //
}
}
• (, ) «»:
$var1 = "Example variable";
$var2 = "";
function global_references($use_globals)
{
global $var1, $var2;
if (!$use_globals) {
$var2 =& $var1; //
} else {
$GLOBALS["var2"] =& $var1; //
}
}
global_references(false);
echo "var2 is set to '$var2'\n"; // var2 ''
global_references(true);
echo "var2 is set to '$var2'\n"; // var2 '' "
• /: , « ».
• PHP , .
• 64- 32- , (intval('9999999999') 9999999999 64- , — 2147483647 32-).
• , , :
SplFileObject
.
•
SplFileObject
SplFileInfo
. ? !?
• PHP
, ,
. , short_open_tags, , ,
, !
• :
in_array("foobar", array(0)) === true
• , «foobar» , 0. , in_array strict, , , === == , - .
•
php.ini , ( ). , .
•
null
,
""
, 0 0.0 — .
• ,
0
, ,
08
,
09
,
012345678
. , 8 9 :
08 == 0
,
08 != 8
,
0777 == 07778123456
( PHP 7).
• , , ; , (
intdiv()
PHP 7).
PHP 5.5 . ( 04/19/2016):
• ( PHP 5).
•
[]
{}
NULL
( PHP 5).
• , ( PHP 5).
• « », () ( PHP 5).
• ( PHP 5):
class Foo {
function Foo($name) {
// $globalref
global $globalref;
$globalref[] = &$this;
$this->setName($name);
}
function echoName() {
echo "\n", $this->name;
}
function setName($name) {
$this->name = $name;
}
}
$bar1 = new Foo('set in constructor');
$bar1->setName('set from outside');
$bar1->echoName(); // " "
$globalref[0]->echoName(); // " "
// , :
$bar2 =& new Foo('set in constructor');
$bar2->setName('set from outside');
$bar2->echoName(); // " "
$globalref[1]->echoName(); // " "
• , , « » , ( PHP 5):
class A
{
function A()
{
echo "Constructor of A\n";
}
function B()
{
echo "Regular function for class A, but constructor for B";
}
}
class B extends A
{
}
$b = new B; // B()
• __autoload , ( PHP 5.3).
• ; create_function , , ( PHP 5.3).
• , ( PHP 5.4).
$first_element = function_returns_array()[0]; // !!
$first_element = ( function_returns_array() )[0]; // , !!
// :
$a = function_returns_array();
$first_element = $a[0];
Perl 5
•
Perl , Python, , . , 14 . 1998.
• «use strict» (« ») — , «use unstrict» (« ») «use slop» (« ») ( /), . . . «» .
use strict;
use warnings;
• .
my @list = ("a", "b", "c");
print $list[0];
• ( Perl6::Subs).
sub foo {
my ($a, $b) = @_;
}
• , .. , - , Perl , .
• . , , .. , , ..
• , , , .
• -. : «, !», — . . , . Perl- , , , ( , , , — : — «»).
• .
• , here-doc.
my $doc = <<"HERE";
But why would you?
HERE
print $doc;
• , , , , . , , : « @{[sub{'like'}]}. ».
• , Ruby, «unless» (« »). «if not», , , :
1. if (! )
2. if ( )
3. unless ()
•
if($a==$b) $c=$d ;
; :
1. $c=$d if($a==$b);
2. if($a==$b) { $c=$d; }
• $,@,%,& ? , … , , , . Perl , , , , @ $ .
• , 6 .
Python
• — « »: , / / .. . -C, , , -, , , .
if(something)
if(something_else)
do_this();
else
do_that();
, «else», , if(), ; Python, , , .
• self , , .
• , a.b() «b» «a»; , , a.b() «a» «» ; :
class NoExplicit:
def __init__(self):
self.selfless = lambda: "nocomplain"
def withself(): return "croak" #will throw if calld on an _instance_ of NoExplicit
a = NoExplicit ()
print(a.selfless()) #won't complain
print(a.withself()) #will croak
, a.b() , ; , « , », Python .
• , , , ; dicts JavaScript, .
• ,
,
«». - . , :
foo = 1.0 + 2 # Foo is now 3.0
foo = 1,0 + 2 # Foo is now a tuple: (1,2)
foo = 3 # Foo is now 3
foo = 3, # Foo is now a tuple: (3,)
• , , . , , . , , , , . , : — !
(1) == 1 # (1) is just 1
[1] != 1 # [1] is a list
1, == (1,) # 1, is a tuple
(1) + (2) != (1,2) # (1) + (2) is 1 + 2 = 3
[1] + [2] == [1,2] # [1] + [2] is a two-element list
isinstance((), tuple) == True # () is the empty tuple
• , .
: .•
.
• - — ; , -, .
• — if/elif/elif ( ).
• "
do ... until <condition>
", "
while not <condition>
:"
• Python (x if cond else y) - : (cond? x: y).
• , .
• .
• , .
• , , 5 ()
[1].
• / — (, list.index()), — (, len(list)).
• , Python
"""
• Python2.x Python3.x Linux .
• :
__main__
• , -, , - :
if __name__ == "__main__":
• — :
f.write(u'blah blah blah\n')
• Python 3 , . , , . Python 3.5 , , , Python , , , .
• «yield» . Python «yield» , , , -, .
• Python 3.5 «async» «await» . Python , «yield» «yield from», . , , , , ,
[2]. , , «yield», , , , «async», .. «def», «with» «for».
• super() , -,
[3].
• , :
os.path.expanduser
os.path.supports_unicode_filenames
( , ).
Python 3
•
!=
<>
(. php).
• :
(-1)**(0.5)
,
pow(-1, 0.5)
0+1j
.
• , .
Ruby
•
String#downcase
? «downcase»? — «lower case,» «lowercase» «lower».
String#upcase
«uppercase» «upper». , , Ruby — . , tw… PHP.
• Unicode , 1.0, 1.9/2.0 2007 .
• / 1.8.
• .
• ( Ruby 2.0, !) ( = ).
•
@
@@
.
• , , ; : .
« » « ». :
1.8.7, 1.9.1 Windows. ?
• ( ) «» :
. « Proc».
• : , , ,
« ».
• «».
nil.to_i
«nil» 0, 0 «nil».
nil.to_i.nil? #=> false
.
•
String#to_i
, :
"x".to_i == 0
.
• Ruby , , , . , , , . Ruby 2.0.
• , , , . ,
Array#size/Array#length
,
Array#[]/Array#slice
.
• , , . , (?) .
• / , .
• ( ) .
• , ,
begin ... rescue ... end if expr
.
if expr
, .
•
unless
(
if not
) , , .
• . , , .
• « » . - , , .
nil
, «void» («») (). , , , .
• pre-1.9: stdout, stderr ( ) - .
•
``
. .
• :
$1
,
$2
,…
• (
Array
,
Hash
) , . — .
class ThingLikeArray < Array; end
.
• , , ,
"foo" != :foo
, , , ,
HashWithIndifferentAccess
.
• . « , kEND, $end» « , '' , ».
• , , .
Flex/ActionScript
• String , , - String, , , startsWith hashCode, pass thrus String.
• , . ( , JavaScript).
• , .
• , .
• , , , - , - , . .
• .
• . . .
• .
• : isalnum, fprintf, fscanf ..
• .
• ? .
• … «» GNU .
• , .
• , - , .
qsort()
- . , - .
• (, , ) , ; , (nspr, apr, glib...).
• . (API) Berkeley, . , API Microsoft . O (1) API ; (select()
poll()
O(n)).
• , , « ».
• 99 ? ; MSVC, 2015 ( ), .
• 11 ? , , GCC , . , MSVC.
• , , , , : , .
, , .
• malloc() ( ), calloc() — ( ).
• «Undefined behaviour» (« ») — . «» « , , , ». ,
« » - .
• int a = 0; f(a, ++a, ++a);
, f(0, 1, 2)
. .
• , «»: i[++a] = j[a];
, , .
• . .
• N intN_t .
• int *
float *
. memcpy()
.
• NULL . — !
• ; ( C, ).
• void (*)()
int (*)(int, const char *)
, , ? ! . , , ( ).
• - , , FILE *
double *
, . .
• - .
• , , ; , , , , (C11, . ) . , , .
• , , ; , - , . , , — « ».
• , () .
++
.
• .
• , - C- C++.
• .
• C++ . , - , . [ .]
• : 1 000 .
•
.
• . - .
• C++ ABI .
• 's' — ?
std::string s();
• : ; , ; , .
• 's' :
std::string s = s(); /* or */ std::string s{};
•
try,
finally.
• «», RAII, , C++. , RAII.
• Unicode.
• , , , .
• , C, strcat
.
•
catch (...)
.
•
throw
.
• :
NULL
C++. [ .]
•
mutable
, ,
const
, , , .
• - ( - ).
• [=]
, .
• C++ , , .
•
std::string::c_str()
std::string char*
. operator
const char* () const
.
• , , , , , inline () ; : , , . ? ?
• , __forceinline
.
• , (), , , , .
• - ; , .
• , ,
,
. , , — , - .
• ,
expor
, , . C ( C++) .
.NET
• SortedList « — ». .NET- , .
• - () , . , «foreach» , . , , , , , . () «for» «foreach».
• MSDN- () GetFrobnicationInterval , , (, ). , InvalidOperationException, . « », , , .
#
• ECMA ISO C# , C# 2.0; Microsoft.
• i++.ToString , ++i.ToString — . ( .)
• , , Visual Basic .NET.
• ( ).
• Pascal (SomeClass, SomeConstantVariable, SomeProperty).
• «extends» «implements» (IInterface).
• ( LINQ, ).
•«out»- ( ).
• , , , , . ( , .
http://stackoverflow.com/questions/82437/why-is-it-impossible-to-override-a-getter-only-property-and-add-a-setter.)
• - ( ) (,
T plus<T>(T t1, T t2) { return t1+t2; }
.
• «foreach» (, foreach(int i in vec) { i = i+1; }.
•
IDisposable . ( , , .)
VB.NET
• Strict Off: , , , ,
lang="text">Dim a As Integer = TextBox1.Text ' ( Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger)
.
• Explicit Off: Object , . Strict Off.
•
On Error Goto
On Error Resume Next
: — . , Try-Catch-Block ( -).
• , UBound(), MkDir(), Mid(),… Microsoft.VisualBasic .
• My-Namespace ( ) ( My.Resources My.Settings, ). , , My.Computer.FileSystem.WriteAllText vs System.IO.File.WriteAllText.
• , , .. , .
• .
• , ( Strict Off) . . StackOverflow.
• The Microsoft.VisualBasic.HideModuleNameAttribute. - .
• .
Form2.InstanceMethod()
Dim Form2Instance As New Form2
Form2Instance.InstanceMethod()
:
MyProject.Forms.Form2.InstanceMethod()
• + & &. + , Strict Off.
VBA
• , — .
• , .
• .
• .
• GoTo.
• `OnError Resume Next` — Yeah… , . ? ! .
• .
.
Dim myRange As Variant
myRange = Range("A1")
Set myRange = Range("A1")
`myRange` «A1», Range.
Objective-C
• - OS X iOS, C; , .
• Objective-C — ; GNUStep Fringe Linux, Windows, … , , .
• .
• « ».
• Smalltalk C .
• .
• ( @ , ?! , ?!? [methodName args];)
•
http://fuckingblocksyntax.com• , , . ( , , LLVM Apple), , , « ».
• SEL
[4].
• . , , , .
• Objective-C++ , .
• Objective-C C++ .
• C++ , , Objective-C.
• C++ Objective-C C++; .
• C++ Objective-C .
• Objective-C , C++, … new.
• ( , ) , .
• Objective-C . Apple NS*.
• Apple Swift ( ) , Objective-C .
Java
• .
• Java ,
goto
const
.
• … . , BigInteger,
a.add(b.multiply(c))
, .
• ; , , .
• :
new T[42]
, , :
class GenSet<E> { Object[] a; E get(int i){return a[i];}}
• . 7-10 , .
• . .
• var ( C#). , . :
// Java
ClassWithReallyLongNameAndTypeParameter<NamingContextExtPackage> foo = new ClassWithReallyLongNameAndTypeParameter<>();
// C# | :
var foo = new ClassWithReallyLongNameAndTypeParameter<NamingContextExtPackage>();
// Java | :
SomeTypeIHaveToLookUpFirstButIActuallyDontReallyCareAboutIt result = getTransactionResult();
• , Java IDE , , .
• . .
Pair
«» .
Java 7 (2011)
•
() , N , N .•
; «allocate; try {...} finally { cleanup; }».
• .
• ,
.
•
int
Integer
,
float
Float
. - .
• , Number.
• Java 8 .
• , , :
• java.net
URLConnection
HttpURLConnection
: UrlConnection
HTTPURLConnection
HttpUrlConnection
?
• java.util
ZipOutputBuffer
GZIPOutputBuffer
: ZIPOutputBuffer
GnuZipOutputBuffer
GzipOutputBuffer
GZipOutputBuffer
?
• , , ; , 3 , , , .. RPGGame
, RpgGame
, TLSConnection
, Starttls
.
•
Cloneable
clone
.
• ,
.toString()
( , -)
.equals()
( , ).
• Java 8 , , , , .., Collection (), « »,
Collections
()
Arrays
().
•
Stack
— ,
Queue
— ?
• Stack
API, . Deque
() ArrayDeque
().
• . , , java.util.Date java.sql.Date ..
• (Date API) , . .
• Java 8 .
• Reflection API .
•
(a|[^d])
StackOverflowException .
• .
.
• , , , , , (
?).
• ,
Serializable
RandomAccess
, : , , - .
• ( , ) .
• :
Object[] foo = new String[1]; foo[0] = new Integer(42);
, .
• Unicode , , , , : (1) \u000A ( ), ; (2) \u0022 ( ), , ; (3) - \u (, , «c:\unix\home»), , .
• (, max(float,float), max(double,double), max(long,long)).
Backbase
• , .
XML
• , , .
• , .
• , Git. , . ( , ), , , .
• .
• , , , .
• .
XSLT/XPath
• 1. * * , . XML DOM.
• XPath , , , , , -. , .
• - XPath, .
• test=""
<xsl:if>
<xsl:when>
.
• <xsl:sort>
.
• - ,
key()
, XML, . — !
select="key(...)"
. , , «key() » , , « ».
•
select=""
,
value=""
match=""
, , . ; , - , - . .
• - (,
str:replace ()
), (, ), , - . .
- ? - , - , , ,
.
• , , . , list/array/tuple/dict/hash/set/iterable/collection.
• '-' , , 'minus' — . '-' , , , , '-' ,
[a-zA-Z_][a-zA-Z0-9_]*
.
, , , .
$foo-100
,
$foo — 100.
• $foo-bar
.
• $foo - 100
.
• $foo+100
$foo + 100
.
• $foo-100
.
• , , . . , , , . , , , , .
<xsl:sort select="count(*)"/>
<!-- sorts like this: 10, 11, 1, 23, 20, 2, 37, 33, 31, 3, 4, 5, 6, 78, 7, 9 -->
• :
1. XML (, ..).
2. XSL (, , / , , , xsl:foo ..).
3. XSL ( ..).
4. XPath ( , ).
5. XPath.
CSS
• hsla(), hsva()?
• text-align:justify;, , « ». .
• vertical-align:middle; , . , display:table; display:table-cell;, , . !
• , , (margin: 0 auto;).
• . .
• float: ; . (, , , , .)
• clear:.
• . , , .
• . CSS3
calc CSS (CSS Values) (Units Module), - { width:50% — 2px; }.
• CSS :
• , , :
• ident {nmstart}{nmchar}*
• nmstart [a-zA-Z]|{nonascii}|{escape}
• nmchar [a-z0-9-]|{nonascii}|{escape}
• «4.1.3. » :
« CSS2 ( , ) [A-Za-z0-9] ISO 10646 161 , (-); .»
•
, [a-zA-Z_][a-zA-Z0-9_]*, 1970- ?
• - -? Webkit , …
• . — Webkit — , .
• SASS, LESS Stylus. . CSS wtf ( , , ).
• , CSS3.
, , , CSS4.
.
«CSS » « , CSS».
CSS3
• ? ? Mac OS 1984. (CSS3 border-radius:)
• . (CSS3 )
• . (CSS3 background-size: background-clip:)
• . (CSS3 rotate)
Scala
•
scala.collection
.
• Monad Functor. Scalaz .
• , , .
• .
• .
Haskell
• ( ) . Haskell - , . , , - .
• .
• .
•
Haskell, - Haskell, - Google.
• Haskell , , . .
Clojure
• Lisp , .. — .
• .
• Conj ( ).
Go
( )
• Go («nil») . void * — . «nil» («») , .
func randomNumber() *int {
return nil
}
func main() {
a := 1
b := randomNumber()
fmt.Printf("%d\n", a+*b) // - ()
}
• , , -ASCII . «» ( ?) .
• , Go —
string
[]byte
.
string
[]byte
, Unicode ,
== > <
,
+
. , , ,
io.Writer
,
[]byte
.
• len , . , ,
utf8.RuneCountInString()
.
• Go
break
case
,
break
switch
. , ,
switch
.
• «n» :
slice = append(slice[:n], slice[n+1:]...)
• , , , .
• , , .
• Go , .
• Go .
• Go .
• Go .
• Go , , :
if v, err := otherFunc(); err != nil {
return nil, err
} else {
return doSomethingWith(v), nil
}
• , Go , . , Go . , « », , , , Go , , , .
• Go-
range
, / , , :
d := loadData()
for i := range d {
// "d" , "i" ,
// "d" , "i"
// "i" //
}
for i, j := range d {
// "d" , !
// , , ,
// , )
// "d" , "i" - , "j" - ( d[i])
// "i" / , "j" d[i]
}
• Go , . , . , :
func foo1(i int) (r int) {
if i != 0 {
r := 12
fmt.Println(r)
}
return // 0
}
func foo2(i int) (r int) {
if i != 0 {
r = 12
fmt.Println(r)
return // 12
}
return // 0
}
func foo3(i int) (r int) {
if i != 0 {
r := 12
fmt.Println(r)
return // : "r"
}
return
}
• , , :
func dogma() (i int) {
defer func() {
i++
}()
return 2 + 2
}
func main() {
fmt.Println(dogma) // 5
}
• , ** , . , Go-:
func returnsError() error {
var p *MyError = nil
if bad() {
p = ErrBad
}
return p // " ".
}
• ,
select
case
, , :
select {
case <-chan1:
doSomething()
default:
select {
case <-chan1:
doSomething()
case <-chan2:
doSomethingElse()
}
}
•
select
700 . .
• Go-, Go- , «» , .
• / , , «ddd» "%H" . Go , «1» , «5» — , «15» — , «6» — .. ( 2 2006 15:04:05 MST) : « , , , ». , , ; , .
• —
math/rand
crypto/rand
.
•
flag
, , POSIX- .
•
errors
, .. Go , .
• Go . Go- repository; github.com/user/package/package-{v1,v2,v3}.
• Go ,
.
• 1.5 C Go. , , .
• "-u", « ». , ,
unsafe
, , ; , , .
• , ** , Go
unsafe
.
• , , « ».
• ,
«WONTFIX» (« , »), , .
•
, ,
. ,
, , , , .
• -
Go 1. , Go 2.0,
.
• 1.4, .
Rust
• borrowck .
• « » . , «» , ; , .
• borrowck, , ,
unsafe {}
; , , , ,
sliceable.unsafe_get(index)
. , , , , .
• , .
• , , , , [
, ]?
• , , , , . — , - , - !
• Rust . , , . , , C++ ( C++, , , , Google).
• LLVM . , , , , « , ,» . , ,
.
, - , , , . , , . SEGV , CRIME, Rust .
. , .
, «» Rust , - .
•
::
++. / .
• , .
#[allow(unrooted_must_root)]
pub fn new(localName: Atom,
prefix: Option<DOMString>,
document: &Document) -> Root<HTMLIFrameElement> {
let element = HTMLIFrameElement::new_inherited(localName, prefix, document);
Node::reflect_node(Box::new(element), document, HTMLIFrameElementBinding::Wrap)
}
#[allow(unrooted_must_root)]
pub fn new(localName: Atom,
prefix: Option<DOMString>,
document: &Document) {
let element = HTMLIFrameElement::new_inherited(localName, prefix, document);
Node::reflect_node(Box::new(element), document, HTMLIFrameElementBinding::Wrap);
}
• , , , ,
impl
()
.
•
mut
, (mutable).
&Mutex
(mutable),
&mut str
— (immutable).
API
• , , , ,
Vec
Cell
.
• , Rust ( ++, , ; —
str
,
String
). :
str
,
String
,
CStr
,
CString
,
OsStr
OsString
. OsStr, OsString, CStr, CString (- Windows), CStr, CString, OsStr, OsString String str, .
• () , .
Vec<T>
,
&[T]
, ,
Vec<T>
&[T]
, , .
• () ,
&*some_var
( )
&some_var[..]
( — ,
Vec<T>
&[T]
String
&str
).
• , , , (, ,
()
, , ).
• -Sized . —
str
[T]
. ,
Sized
, ,
?Sized
. , Reddit, , str .
Box<str>
. Reddit; Reddit, , , -Sized .
• —
enum
. .
•
, , . (
) , .
• «». Rust (, , «, , , » ), . , , , Rust - Java!
• rustc .
•
rustc. PIC. AVR. m68k. ARM, x86, MIPS, PowerPC NaCl. , .
• ? . — rustc .
• (, Go, ), , , .
• , . , , , .
• - , . , rustc .
• . «» , , , «ring» ( ) «serde» («serialization and deserialization» (« »), ?).
• jemalloc, «hello world» [
].
• , , . , rustc ?
• , , ( , ++, ). , ?
• IDE. - C# VS Java Eclipse, 90-.
• IDE, , Eclipse? .
• ? , , , , « ». , , Racer, .
• ? , .