The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

barruumrex (3) [Avatar] Offline
#1
There's a bit of an elephant in the room in chapter 1. In Javascript, everything is an object. This influences how code is written at the most basic level. Elm has no such concept and this causes some simple actions to feel foreign. This distinction ends up being made in asides through sections 1.2 and 1.3. The asides distract from the core of those sections and make them feel less focused. Section 1.4 feels much tighter in comparison. The comparisons between Elm and Javascript in that section are specific to collections.

I think the chapter would benefit from having a section specifically calling out the ideological differences between the two languages. It could provide a light introduction to modules and how they assume some of the responsibilities of Javascript objects. This could also be where the repl is introduced for showing off the examples. Moving these pieces into their own section would allow the sections on expressions, functions, and collections to be more narrowly focused on their topics.
rtfeldman (60) [Avatar] Offline
#2
Thanks for the feedback!

I thought about doing a broad comparison early on, but I found myself needing to use terms that I hadn't explained yet. For example, suppose I write "Elm uses referentially transparent functions that can return command values, instead of having side-effectful functions." That's a true statement, and by the end of Chapter 3 it'll be a concept I've explained, but back in Chapter 1 it'd just be confusing for most readers. smilie

I think the "incremental reveal" approach is best here.
barruumrex (3) [Avatar] Offline
#3
Fair enough. I'm still having difficulty properly phrasing what it was about those early sections that felt weird to me. The suggestion was the closest I could get. I plan to do another read of the chapter in the next week to see if that feeling holds. Maybe I'll come up with something more specific. Or maybe I was just in a weird mood on the first read, and it won't be there at all next time.
Jim Haungs (9) [Avatar] Offline
#4
ASSIGNING CONSTANTS TO EXPRESSIONS

Not only can you assign constants to literal values, you can also assign them to expressions.

The phrase in bold does not make any sense.
rtfeldman (60) [Avatar] Offline
#5
I'll try to rephrase that sentence. Thanks!
Jim Haungs (9) [Avatar] Offline
#6
I've attached two screenshots, portrait and landscape, from the Kindle app on my iPad. Some of the code is so unreasonably formatted, it made me laugh out loud.
rtfeldman (60) [Avatar] Offline
#7
Yikes! Thanks for the screenshots...I've passed this along to our Graphics folks. smilie
mpasic (10) [Avatar] Offline
#8
@Jim Haungs
Mehmed from Manning here.
If you have an iPad, I will recommend to use iBooks app from your device as the best app to read our books.
I can see that your Kindle app is set in "Justify" mode rather "Left". Text in our files is aligned left so maybe you can try that too.
We will try to reduce unnecessary spacing in the future but for now please check this title using epub version on iBooks.

Mehmed
mepa@manning.com
Jim Haungs (9) [Avatar] Offline
#9
As far as I know, there is no way to change the justification in the Kindle app. It's part of the document definition.
tempusfugit (144) [Avatar] Offline
#10
I can recommend

Gerty - eBook reader for epub, journal, notes, photos and maps

if you don't like the standard iBook App. The only drawback is that it only supports epub files - but it deals with them beautifully.

Getting started with Gerty

About File Sharing on iPhone, iPad, and iPod touch

I personally only use the Kindle app for material that I am, for one reason or another, forced to source through Amazon.
505046 (1) [Avatar] Offline
#11
I'm just getting started with the book, working my way through the elm REPL examples in one terminal pane while writing the accompanying JavaScript in another pane running Node. I think the JavaScript example of the capitalize function should be edited as follows:

function capitalize (str) {
  if (typeof str !== 'string') {
    return str;
  } 
  return str[0].toUpperCase() + str.slice(1);
}


In the function as written,
if (!str)
can lead to some strange results because it uses coercion to cast whatever type the str variable is into a boolean.

For clarity, let's write out the book version and call it oldCapitalize:

var oldCapitalize = function (str) {
  if (!str) {
    return str;
  }
}


If you call oldCapitalize(true) it will throw a TypeError (Cannot read property 'toUpperCase' of undefined)