GithubHelp home page GithubHelp logo

dpc's People

Contributors

dvanhorn avatar jdanbrown avatar rhcarvalho avatar samth avatar takikawa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

rhcarvalho zcc101

dpc's Issues

Need default on-tick

Big-bang breaks when given a union where one world implements an on-tick and another doesn't.

Unclear statements

As in Chapter 17:

The functional style is slow, but easy.
The structural style is fast, but hard.

  1. Slow/fast and easy/hard are vague terms here, aren't they?
  2. Are the statements in the perspective of the language designer or the programmer?

image and web page don't play nice together

In chapter/06/exercise.scrbl there was a use of (image "book/chapter/06/tron1.png") but this path is not resolved correctly when building the web page. We need some way of inserting an image that works in both the book and on the class web page.

field/method confusion

#lang class1

(define-class a%
  (fields one))

(define-class b%
  (super a%)
  (fields one))

; Error msg: class*: superclass #<class:a%> already contains method: one for class: b%

; Desired error msg: class*: superclass #<class:a%> already contains field: one for class: b

State pattern and on-msg in servers is broken

If a universe server starts in a state without a on-msg method and then transitions to one with an on-msg, that method is never called.

Here is a simple client/server that should error once a message is relayed back to the client, instead the on-msg method is never called, thus never sending a message back.

#lang class/0
(require class/universe)
(require 2htdp/image)

(define-class wait%
  (define (on-new iw)
    (new begin%)))

(define-class begin%
  (define (on-msg iw msg)
    (make-bundle this (list (make-mail iw msg)) empty)))

(define-class client%
  (define (register) LOCALHOST)
  (define (on-tick)
    (make-package this 'tick!))
  (define (on-receive msg)
    (error "Got here!"))
  (define (to-draw)
    (empty-scene 20 20 "yellow")))

(launch-many-worlds
 (universe (new wait%))
 (big-bang (new client%)))

mutator methods

We've moved away from the (field f) form of referencing fields and instead have used automatically generated accessor methods: (send this f).

We should do the same for (set-field! f x). I propose we generate mutator methods (send this f! x).

There is some potential for this going wrong, eg if you have a class with fields f and f!, then method f! is ambiguous, but so long as this is a syntax error, it seems fine.

Wrong error locations with send

#lang racket

(require class0)

(define-class A%

  (define/public (ok)
    (send 0 oops))

  (define/public (bad)
    (new A% 0)))

; Run each of these separately in DrRacket:
;(send (new A%) ok)  ; Good error location: body of `ok' method
;(send (new A%) bad) ; Bad error location: call site of `bad' method

bad error messages with .

#lang class/1

(define x 0.1)
; define: bad syntax (multiple expressions after identifier) in:
; (define DT 0 |.| 1)

(define y ((λ (x) x) 0.1))
; .: not legal outside of method send syntax in: |.|

Bad error message for define-like things

This gives a bad syntax error:

#lang class/0
(define-class a%
  (define/asdf (m) 1))

which is

define-class: There were multiple syntax errors. The first error follows:
expected the identifier `isl+:check-range' in: define/asdf

Obviously the isl+:check-range is a nasty implementation artifact.

Typos in Chapter 11

First:

Page 138, first paragraph, sentence:

One natural design is to take write a method that encapsulates the similarities of
fast or old, say filter, and add a parameter that consumes the differences, that is,
the predicate, represented as a function [Runner -> Boolean].

(emphasis mine)

Should probably be

One natural design is to write a method...

Second:

Page 138, second paragraph, first sentence:

But what if we wanted to reresent these predicates with objects? Is such a thing
possible?

(emphasis mine)

"define" does not work in class/1 or above

The following code fails with an error:

#lang class/1

(define-class point%
  (fields x y)
  (define (move-x dx)
    (new point%
         (+ (send this x) dx)
         (send this y))))

The error is "define-class: There were multiple syntax errors. The first error follows:
expected the identifier `isl+:check-range' in: define"

This is a problem since class/1 and higher are supposed to be supersets of class/0.

Problem sets as chapters

Currently, several "chapters" in the book are actually just exercises from 2011 homeworks. These should be integrated into other chapters.

public and private in `class/0`

class/0 supports define/public and define/private. We can't take them out until after the semester, but then they should go.

typo in chapter 3 of dpc

from the textbook:

(define-class world%
(fields light)
(define (tick-rate) 5)
(define (to-draw)
(send (send this light) draw))
(define (on-tick)
(new world% (send (send this light) switch))))

switch is undefined; should be "next" instead

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.