nodejs 8 import module – require or import? [duplicate]

UPDATE-2018.11.15 ↓ Short answer We’re still using require Long answer ESM loading has partially landed in node 8.5.0 which was released in September 2017. As such, it has beeen part of the specs as an experimental feature for a little while: see the API documentation here. Caveats include the need for the –experimental-modules flag and … Read more

Explicitly import instances

The inability to control imports of instances is one of the trade-offs the Haskell typeclass system makes. Here’s an example in a hypothetical Haskell dialect where you can: Foo.hs: module Foo where data Foo = FooA | FooB deriving (Eq, Ord) Bar.hs: module Bar (myMap) where import Data.Map (Map) import qualified Data.Map as Map import … Read more

If you’re opening a file using the ‘with’ statement, do you still need to close the file object?

The answer to your immediate question is “No”. The with block ensures that the file will be closed when control leaves the block, for whatever reason that happens, including exceptions (well, excluding someone yanking the power cord to your computer and some other rare events). So it’s good practice to use a with block. Now … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)