Profile

Cover photo
Douglas Crockford
Works at PayPal
Lives in San Jose
1,896,255 views
AboutPosts

Stream

Douglas Crockford

Shared publicly  - 
 
I will be headlining at the Tel Aviv Frontend Conference, June 8-9.
22
1
Chris Laffra's profile photoSergey Bolshchikov's profile photo

Douglas Crockford

Shared publicly  - 
 
Which do you like better: magenta or fuchsia?
17
3
Brian Neil Burg's profile photokurri sudarshan reddy's profile photoVan Riper's profile photoАнатолий Демидович's profile photo
3 comments
 
My preference is magenta!  It sounds so majestic!

Douglas Crockford

Shared publicly  - 
 
Looking at Google Trends: iphone slower vs android slower. The iphone trend is much spikier than I would expect.
12
3
Nicholas “beaverusiv” Loomans's profile photoShaunak Jadav's profile photoDjordje Puzic's profile photoAndrés Serrón's profile photo
 
Seems legit to me. The spikes would correspond with OS updates I'm sure.

Douglas Crockford
owner

Discussion  - 
 
IN DEVELOPMENT

I am doing the first rewrite of JSLint since the project began in 2001. It is not finished yet, but it is stable enough that you can start poking at it. I have significantly changed the way options work. There are far fewer of them, and they work at file granularity, not block as before. I have moved this and for to the endangered list as we are now able to better embrace the functional paradigm. I haven't figured out what to do with arguments yet.

This rewrite was motivated by ES6. The old version was designed for ES3. New features like megastring literals and farts are a challenge to the old framework.

I expect the new version is way too strict in some ways, and way too lenient in others. It will take some time to get the balance right.

The things I am looking for right now are crashes: texts that JSLint is unable to complete.
JSLint, The JavaScript Code Quality Tool. This file allows JSLint to be run from a web browser. It can accept a source program and analyze it without sending it over the network.
32
6
Samokhin Alex's profile photoЕвгений Орехов (Evgeny Orekhov)'s profile photoAlexandre Morgaut's profile photoLara Sweeney's profile photo
29 comments
 
+Douglas Crockford Thanks for making above error a comment only.

Another problem I found is with destructuring a function call result directly, e.g.:

let {Route, DefaultRoute} = require('react-router');

this results in:
Expected ';' and instead saw '('.

What's the reasoning behind that warning?
Add a comment...

Douglas Crockford

Shared publicly  - 
 
CSS Question:

I want to underline all of a span except the first letter. I put a decoration on the span, and put a decoration of none on the ::first-letter. But that doesn't work because none does not remove the underline, it only doesn't add any additional decoration.

I can do this trivially with <u>:

    <span>F<u>irst</u></span>

Is there a way to do it with CSS?
19
4
Sam Anderson's profile photoAubrey Taylor's profile photoPanos Papadopoulos's profile photoIshmael Ahmed's profile photo
21 comments
 
That is the problem I identified at the very beginning of this topic. I was looking for confirmation of my reading that CSS in its current form is broken. I was hoping that I was missing something, but it seems now that I wasn't. Thank you.

Douglas Crockford

Shared publicly  - 
 
RegExp and Template Strings

JavaScript's RegExp constructor takes a string and returns a regular expression object. It is really difficult to use. Regular expressions are difficult to write because the notation is so terse and all mushed together. Writing regular expressions with string literals is even harder because of the need to double the backslashes and escape the quotes. It was recommend that you always use regular expression literals instead.

ES6 introduces a new string literal, the unfortunately named template string. It wraps a string in ` characters, allows it to span several lines, and avoids escapement. This turns out to be really helpful when composing regular expressions.

For example, make a little helper function that wraps RegExp while automatically deleting whitespace.

    function regexp(string, flags) {
        return new RegExp(string.replace(/\s/, ''), flags);
    }

Soon, instead of writing

    var rx_number = /^(0(?:b[01]+|o[0-7]+|x[0-9a-fA-F]+|\.[0-9]+(?:e[+\]?[0-9]+)?)?|[1-9][0-9]*(?:\.[0-9]+)?(?:e[+\]?[0-9]+)?)$/;

ES6 allows you to instead write

    const rx_number = regexp(`^(
        0   (?:
                b [01]+
            |   o [0-7]+
            |   x [0-9 a-f A-F]+
            |   \. [0-9]+ (?: e [+\-]? [0-9]+ )?
            )?
    |   [1-9] [0-9]*
            (?: \. [0-9]+ )? (?: e [+\-]? [0-9]+ )?

    )$`);
    
Which one would you want to maintain?

Regular expressions are still cryptic and bizarre, and I hope that someday we get a notation that is more reasonable, like the Rebol parse dialect. But until then, template strings are a huge improvement.
77
15
Christoph Lühr's profile photoАнатолий Демидович's profile photo

Communities

Douglas Crockford

Shared publicly  - 
 
I will be headlining at Angular U.
Douglas Crockford. Douglas Crockford is an American computer programmer and entrepreneur who is best known for his ongoing involvement in the development of the JavaScript language and for having popularized the data format JSON.
33
3
Robert Zey's profile photoAnders Dam Kofoed's profile photo

Douglas Crockford
owner

Discussion  - 
 
Does it make sense to allow /global/ and import in the same file?
2
Sam Mikes's profile photoЕвгений Орехов (Evgeny Orekhov)'s profile photoDouglas Crockford's profile photo
9 comments
 
I was missing an example. Please try it now.
Add a comment...

Douglas Crockford
owner

Discussion  - 
 
Destructuring

The next edition will accept destructuring when the ES6 option is selected, but with some restrictions:

> It will not allow deep destructuring. That would encourage some extremely bad practices, transforming the feature from convenience to attractive nuisance.

> It will not allow destructuring var statements. New programs should be using let and const from now on.

> It will not allow destructuring with assignment statements. {} doesn't work on the left of = because of syntactic confusion with blocks.
7
Raul-Sebastian Mihăilă's profile photoDouglas Crockford's profile photo
2 comments
 
No, it won't. JSLint recommends using a const statement instead.
Add a comment...

Douglas Crockford

Shared publicly  - 
 
An interesting observation about OOP from Thumbleweed Park

On the programming side, I was having some issues with how Squirrel handled classes, so I ditched the notion of rooms being classes and just made them simple tables/dictionaries. It works a lot better since I don't really need full-on classes for the rooms...

It could be argued you might want to create a base room class and derive from that, especially in the case of generic rooms like the forest in Monkey Island and the hotel in Thimbleweed Park, but endless class deriving and polymorphism is a pit of pain and eye poking. Object oriented programing (or OOP we pros call it) can make you feel very clever, but sometimes it feels like it's being used just because it makes you feel very clever.
There is no UI for the character switching, and we don't know exactly how we're going to do it yet, but it's completely functional. Maniac Mansion had a New Kid verb that displayed a list of the kids that you would then click on to switch. We don't have the space for another verb, ...
25
2
Exuper Okouya's profile photoGernot Kieseritzky's profile photo

Douglas Crockford

Shared publicly  - 
 
I was in the games business back in The Atari Age, but I eventually got bored with it and moved on. castAR is giving me the itch again.
25
4
Wicked Logic's profile photoChris Jones's profile photoNufayl Razick's profile photoIvan Pierre's profile photo
 
Want!

Douglas Crockford

Shared publicly  - 
 
There are two letters that have been allowed in number literals, E and X. Should they be written in upper case or lower case? There doesn't seem to be any good argument to support either case.

ES6 gives us an answer. ES6 introduces two new letters, B and O, which are used to indicate binary and octal, respectively. O is obviously a terrible choice because it looks like zero. This badness is mitigated by using the lower case o.

So in number literals, lower case letters should be used: b, e, o, x.
45
4
Wicked Logic's profile photoMark Bridge's profile photoIvan Pierre's profile photoАнатолий Демидович's profile photo
 
Agreed. O was not a great choice.
Communities
Work
Occupation
The Boss of You
Employment
  • PayPal
    present
Basic Information
Gender
Male
Story
Tagline
_ __ ___ ____ _____ In the Twenty First Century!
Introduction
On the internet, nobody knows you're a Doug.
Bragging rights
I discovered the JSON Data Interchange Format. I also discovered that JavaScript has good parts. That was the first important discovery of the 21st Century.
Places
Map of the places this user has livedMap of the places this user has livedMap of the places this user has lived
Currently
San Jose