Giter Site home page Giter Site logo

Comments (4)

soniakeys avatar soniakeys commented on August 15, 2024

Addressed with PR #107

from go.

kytrinyx avatar kytrinyx commented on August 15, 2024

I'm reopening this per the discussion here: exercism/exercism#1910

Summary: The definition of "not defined" means anything could happen.

from go.

soniakeys avatar soniakeys commented on August 15, 2024

Undefined behavior is not idiomatic Go. I'm against removing the error return. Actually I think this is an excellent problem to introduce the error result. The problem is fairly simple, and the error condition is both intuitively clear and trivial to detect. (Queen-attack uses the error return and is currently ahead of Hamming in config.json, but I'm not sure it should stay there. I expected most people would find Queen-attack a harder problem.) Anyway Hamming is currenly 17th in config.json. The error return is such an funcamental part of Go that I would actually be happy with introducing it return earlier!

I know I tried to make this thing happen with introducing error handling with the Binary/Octal/Hex sequence but that turned out a little strange. I think there are now four problems that require error handling before Binary. In Binary, the concept was to put the error return in the API but not check the value in the tests. We could do the same here for Hamming but really this is kind of strange thing to do. Go doesn't allow variable assignment unless the variable is used. Requiring a return value that is never checked is close to the same thing.

With the current README, we could add a comment to the test file explaining to return an error for unequal lengths but I think the API and tests are okay the way they are.

from go.

kytrinyx avatar kytrinyx commented on August 15, 2024

Undefined behavior is not idiomatic Go.

Yeah, you're right. I think that here the language trumps Wikipedia, and that creating a contract makes sense. I'm going to close again.

I do think that hamming would make sense earlier in the series.

from go.

Related Issues (20)

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.