Thursday, July 17, 2008

Comments on Comments on the Previous post

  • Henry Ware suggested a modification to the builder with abstract members removing a lot of the boilerplate. Incidentally, this is a nice illustration of how nested types can be put to a good use in Scala.
  • Justin ported the code to Haskell, which was very cool.
  • A couple of commenters suggested that languages with support for default parameter values (like Python and Groovy) don't need elaborate constructs such as the builder pattern. There are two ways to respond. One is to remind that the intent of the pattern, specially as originally described in the GoF book, has little to do with optional data. The other is to acknowledge that I probably put too much emphasis on this issue and forgot to mention a very common idiom for building objects in Scala: just declare mandatory "parameters" as abstract vals and optional ones as concrete vals with default values, like so:
    abstract class OrderOfScotch {
    val brand:String
    val mode:Preparation
    val isDouble:Boolean
    val glass:Option[Glass] = None
    }

    And to instantiate:
    val myDose = new OrderOfScotch {val brand = "Bobby Runner"; val mode = OnTheRocks; val isDouble = false}
  • I guess that's it. Thanks y'all.

19 comments:

Anonymous said...

The class "OrderOfScotch" has to be abstract - or a Trait, because there are abstract members...
(trait OrderOfScotch {/*...*/})

Unknown said...

You're right meiko, thanks. I'll update the post to correct the mistake.

omni verma said...

Papers pf Cbse 10th 12th
Cbse 10th 12th papers
Cbse 10th 12th Quesiton papers
Msbte time Table and Quesiton Paper
Msbte time Table and Quesiton Paper Download
Msbte time and Previous Quesiton Paper
Download Msbte time and Quesiton Papers
Msbte time and Msbte Quesiton Paper
Msbte time Table and Msbte Quesiton Paper

Janu said...

very useful for my research. It shows your interest in this topic very well. I hope you will post some more information about the software. Please keep sharing!



Dot Net Training in Chennai | Dot Net Training in anna nagar | Dot Net Training in omr | Dot Net Training in porur | Dot Net Training in tambaram | Dot Net Training in velachery


James said...

Data Science resources are also available online and some educational providers also offer online training of the course. data science course syllabus

Ashok said...

Wow what a Great Information about World Day its exceptionally pleasant educational post. a debt of gratitude is in order for the post.
data science course in India

opbest said...


Awesome dispatch! I am indeed getting apt to over this info, is truly neighborly my buddy.
Likewise fantastic blog here among many of the costly info you acquire. Reserve up the beneficial process you are doing here.

My web page::; 풀싸롱

(freaky)

Kaylee Brown said...

Writing a thesis proposal is not very easy nor more challenging. It is all about concentrating on the study and writing the best proposal within the deadline. As a result, many students find it onerous to write a thesis proposal, as it needs extensive analysis in the field. Some lecturers want a specific structure, as well as scholarly references with minimal plagiarism, in addition to time constraints. When you need to satisfy the format requirements with original, non-plagiarized work, it's good to get a reliable assistance. You can also use our knowledge for thesis proposal help. You don't have to go through the same trouble that your peers and seniors had. We know how real work is happening with the help of experts.

Anton Dcruze said...

Are you stuck while doing your college assignments or assessment. Don't worry you are not the only one who face issue while crafting assignments. Even scholars face difficulty in crafting their assignments or assessments on their own. There is a simple solution to this problem, hire an assignment expert who will give you a guidance to complete your assignment and attain good marks. You can take any assignment help like HR Assignment Help, CHCPRP001 Assessment Answers help, MYOB assignment help.

Links For You said...

i'd subsequent to to make regarded that this blog clearly satisfied me to take steps it! thanks, each and each one fine reveal... https://crackdj.com/bandicam-keygen-full-crack-download/

cyber pc said...

tremendous article, thank you for putting this collectively! this is obviously one allowable publicize. thanks for the important advice and insights you have as a end result furnished right here..... https://cyberspc.com/microsoft-office-2010-full-version/

Roadrunner Password Recovery said...

Thanks for sharing. I found a lot of interesting information here. A really good post, very thankful and hopeful that you will write many more posts like this one.

tech2 said...

Merry Christmas! May God shower your life with unlimited blessings on this day. Wishing your holiday season be filled with sparkles of joy and .Merry Christmas Wishes Text

norsk førerkort said...

kjop forerkort uten eksamen.

cumpara permis conducere .

kopa korkort.

comprare carta conducao.

comprare patente.

kjop forerkort.

comprar licencia de conducir.

Girish said...

TVS Motors offers motorcycles in Bangladesh, including the Apache series in budget options. For the latest prices and specifications, contact your local authorized dealer. For up-to-date prices and specifications, connect with authorized dealers in your area.For the most current prices and specifications, reach out to authorized dealers in your locality.For up-to-date prices and specifications, connect with authorized dealers in your area.For the latest prices and specifications, contact your local authorized dealer More information here TVS Bike Price in Bangladesh.

실시간 바카라사이트 said...

I wanna say thank you for providing this great information. Great job

안전한 카지노사이트 said...

A really good post, Very thankful. Write many more posts like this one.

슬롯사이트 순위 said...

Wonderful items from you, man. You’re making it entertaining blog. Thanks

토토사이트 추천 said...

You're one of the highest quality sites online. You're great. Magnificent it is