background preloader

PHP: a fractal of bad design - fuzzy notepad

PHP: a fractal of bad design - fuzzy notepad
(This article has been translated into Spanish (PDF, with some additions) by Jorge Amado Soria Ramirez — thanks!) Preface I’m cranky. I complain about a lot of things. This is not the same. PHP is the lone exception. PHP is an embarrassment, a blight upon my craft. But I’ve got to get this out of my system. An analogy I just blurted this out to Mel to explain my frustration and she insisted that I reproduce it here. I can’t even say what’s wrong with PHP, because— okay. Stance I assert that the following qualities are important for making a language productive and useful, and PHP violates them with wild abandon. A language must be predictable. My position is thus: PHP is full of surprises: mysql_real_escape_string, E_ALLPHP is inconsistent: strpos, str_rot13PHP requires boilerplate: error-checking around C API calls, ===PHP is flaky: ==, foreach ($foo as &$bar)PHP is opaque: no stack traces by default or for fatals, complex error reporting I’ve been in PHP arguments a lot. Core language Text Related:  Languages

3 new programming languages to watch Aug 6, 2013 (that you've probably never heard of) On the eve of learnxinyminutes.com getting TechCrunch'd , I thought I'd write about a few of my favorite languages on the site. Learn X in Y minutes has a lot of conventional blockbusters like C and Java now, as well as old cult favorites like Haskell and Erlang , but it was the independent films — that is, languages — that received some of the earliest attention, occasionally by their creators themselves. Livescript , a functional dynamic language that compiles to javascript Julia , a high-performance high-level scientific computing language, and Elixir , Erlang's younger, cooler cousin. Livescript Livescript is a compiled-to-javascript language in the vein of CoffeeScript. Argument destructuring: tail = ([head, ...rest]) -> rest tail [ 1 , 2 , 3 ] # => [2, 3] Currying: add = ( left , right ) - -> left + right add1 = add 1 add1 2 Three flavours of function composition (two of which seem to be the same): Guard-esque switch statements: Julia Elixir

19 Performance 19 Performance Alan Perlis famously quipped “Lisp programmers know the value of everything and the cost of nothing.” A Racket programmer knows, for example, that a lambda anywhere in a program produces a value that is closed over its lexical environment—but how much does allocating that value cost? While most programmers have a reasonable grasp of the cost of various operations and data structures at the machine level, the gap between the Racket language model and the underlying computing machinery can be quite large. In this chapter, we narrow the gap by explaining details of the Racket compiler and run-time system and how they affect the run-time and memory performance of Racket code. 19.1 Performance in DrRacket By default, DrRacket instruments programs for debugging, and debugging instrumentation can significantly degrade performance for some programs. 19.2 The Bytecode and Just-in-Time (JIT) Compilers 19.3 Modules and Performance 19.4 Function-Call Optimizations Using set! the set!

1. Kaleidoscope: Tutorial Introduction and the Lexer 1.1. Tutorial Introduction Welcome to the “Implementing a language with LLVM” tutorial. The goal of this tutorial is to progressively unveil our language, describing how it is built up over time. It is useful to point out ahead of time that this tutorial is really about teaching compiler techniques and LLVM specifically, not about teaching modern and sane software engineering principles. I’ve tried to put this tutorial together in a way that makes chapters easy to skip over if you are already familiar with or are uninterested in the various pieces. Chapter #1: Introduction to the Kaleidoscope language, and the definition of its Lexer - This shows where we are going and the basic functionality that we want it to do. By the end of the tutorial, we’ll have written a bit less than 700 lines of non-comment, non-blank, lines of code. A note about this tutorial: we expect you to extend the language and play with it on your own. 1.2. Lets dive into the implementation of this language! 1.3.

Home · frenchy64/Logic-Starter Wiki Lisp: Common Lisp, Racket, Clojure, Emacs Lisp - Hyperpolyglot a side-by-side reference sheet grammar and invocation | variables and expressions | arithmetic and logic | strings | listsarrays | dictionaries | functions | macros | execution control | file handles | file buffers | files | directoriesprocesses and environment | libraries and namespaces | objects | reflection | java interop General version used Versions used to verify data in the cheat sheet. show version How to determine the version. compiler racket Compiling a.ss creates the byte-code compiled file a_ss.zo, which will be used by mzscheme in preference to the source code if it encounters making a standalone executable common lisp A standalone executable is created by the sb-ext:save-lisp-and-die function. In order for code to be compiled as a standalone executable, it must be packaged as a module. #lang scheme (define hello (printf "Hello world! A standalone executable can be created with DrScheme using Scheme | Create Executable… emacs Building Emacs shebang emacs lisp #! An implementation of echo: #!

F*dging up a Racket Danny Yoo <dyoo@hashcollision.org> Source code can be found at: The latest version of this document lives in 1 Introduction Is that really true? Racket does include a nice macro system, which allows a programmer to add in new language constructs. So we can certainly extend the language. Let’s take a closer look at a Racket program. Why in the world does a Racket program need to say that it’s a Racket program? We can understand the situation better by looking at another environment on our desktop, namely the web browser. HTML 5 tries to make this determination somewhat more straightforward: we can define an HTML 5 document by putting a DOCTYPE element at the very top of the file which self-describes the document as being html. Going back to the world of Racket, we see by analogy that the #lang line in a Racket program is a self-description of how to treat the rest of the program. Ignoring the question of why?!! Good!

purelang / pure-lang Bitbucket is a code hosting site with unlimited public and private repositories. We're also free for small teams! Sign up for freeClose Pure is a modern-style functional programming language based on term rewriting. Please check our website at purelang.bitbucket.org for more information. Please also check my personal Bitbucket site for some fun side projects that I've written in or for Pure (mostly about computer music and multimedia). Albert Gräf aggraef@gmail.com Enjoy. :) MarkusQ/crystal Linear Regression 3 Ways in Julia « boss-level.com Julia is a new upstart numerical language that I've been looking at recently. Its still very rough, not even 0.2 yet, but it has some impressive chops. As an alternative to R and MATLAB, it has a lot going for it. Much has been made in blogs and forums about the advertised speed, and whether this is hyped or not. I think this misses the point; what is important is the tradeoff of speed for expressiveness. About the most simple thing you can do in stats is a linear regression. Firstly the code is very readable (and as a lisp fanboy I surprise myself there). I really like this, and don't think I could have written this code so succinctly in any other language.

Julia introspects When people are introspective, they're thinking about how their minds work, about how and why they think what they do. The Julia language has some impressive facilities for letting you see how the compilers' mind works. Using convenient built-in functions that are available both at the REPL and in normal code, Julia allows you to see the layers of internal representation that your code goes through, from the parsed AST to native assembly code. This allows you to answer some otherwise difficult questions very easily. (and allows you to peer into the inner workings of the compiler, which is just plain fun.) A Simple Question: I wonder if it matters which of these I use? One of the questions I have pondered is whether two syntaxes for assigning variables make a performance difference. The most straight-forward approach: function linear_foo() x = 4 y = 5end Sometimes this looks nicer: function tuple_foo() x,y = 4,5end For example: function tuple_foo2() x,y = 4,5 yend becomes Layers Layer 1: The AST

Frink Applet About Frink * See data file * What's New * FAQ * Download * HTML-only Interface * Sample Programs * Frink Server Pages * Donate Please be patient. The applet is about 822 kB and will take about 90 seconds to load with a 56 kb/s modem. (It's only 270 kB if you're using Java 1.5 or later, thanks to pack200 compression.) Error loading the Java applet above? Get a recent version of Java (Version 1.5.0 update 2 or later is very strongly recommended due to bugs in previous versions) or use the Minimal Interface. When this document loads, you will be asked if you want to trust the applet. The certificate is signed only by me, so you will see a warning.

Related: