134 Matching Annotations
  1. Dec 2024
    1. There is a tremendous power in thinking about everything as a single kind of thing, because then you don’t have to juggle lots of different ideas about different kinds of things; you can just think about your problem.

      In my experience this is also the main benefit of using node.js as your backend. Being able to write your front and backend code in the same language (javascript) removes a switching cost I didn't fully realize existed until I tried node the first time.

  2. Sep 2024
    1. In comparison, Perl/Python/Javascript, which also have the latter property, have other false-like values (0 and empty string), which make || differ from a null-coalescing operator in many more cases (numbers and strings being two of the most frequently used data types). This is what led Perl/Python/Javascript to add a separate operator while Ruby hasn't.
    2. Examples by languages
  3. Mar 2024
  4. Dec 2023
  5. Oct 2023
    1. When a language presumes to know more than its user, that's when there's trouble.
    2. Just because a language has a feature that might be dangerous doesn't mean it's inherently a bad thing. When a language presumes to know more than its user, that's when there's trouble.
    3. I'd argue that when you find a programming language devoid of danger, you've found one that's not very useful.
    4. The reason eval is there is because when you need it, when you really need it, there are no substitutes. There's only so much you can do with creative method dispatching, after all, and at some point you need to execute arbitrary code.
  6. Sep 2023
    1. I think "purely functional, not a single re-assigned variable" often introduces significant extra complexity, when Ruby is a language that embraces both functional and imperative programming.
    2. One of my favorite aspects of Ruby is how easy it is to write in a functional programming style, and including the scan operation would expand the number of use cases covered by functional methods.
  7. Aug 2023
  8. Jun 2023
    1. TypeScript offers special syntax for turning a constructor parameter into a class property with the same name and value. These are called parameter properties

      Doesn't this violate their own non-goal #6, "Provide additional runtime functionality", since it emits a this.x = x run-time side effect in the body that isn't explicitly written out in the source code?

  9. Dec 2022
  10. Nov 2022
  11. Oct 2022
  12. Sep 2022
    1. For example, whereas C programmers have argued for years about where to put their brackets, and whether code should be indented with tabs or spaces, both Rust and Go eliminate such issues completely by using a standard formatting tool (gofmt for Go, rustfmt for Rust) which rewrites your code automatically using the canonical style. It’s not that this particular style is so wonderful in itself: it’s the standardisation which Rust and Go programmers appreciate.
    2. If you like the functional style of programming, though, you’ll find a lot more facilities for it in Rust, because Rust has a lot more facilities than Go in general.
  13. May 2022
    1. I think RSpec should provide around(:context)/around(:all). Not because of any particular use case, but simply for API consistency. It's much simpler to tell users "there are 3 kinds of hooks (before, after and around) and each can be used with any of 3 scopes (example, context and suite)". Having some kinds of hooks work with only some kinds of scopes makes the API inconsistent and forces us to add special case code to emit warnings and also write extra documentation for this fact.
    2. I've been thinking of looking into implementing this in rspec-core, primarily to make the API more consistent (e.g. so that you can combine any scope -- example/context/suite -- with any hook type before/after/around).
  14. Feb 2022
    1. "Context" manipulation is one of big topic and there are many related terminologies (academic, language/implementation specific, promotion terminologies). In fact, there is confusing. In few minutes I remember the following related words and it is good CS exam to describe each :p Thread (Ruby) Green thread (CS terminology) Native thread (CS terminology) Non-preemptive thread (CS terminology) Preemptive thread (CS terminology) Fiber (Ruby/using resume/yield) Fiber (Ruby/using transfer) Fiber (Win32API) Generator (Python/JavaScript) Generator (Ruby) Continuation (CS terminology/Ruby, Scheme, ...) Partial continuation (CS terminology/ functional lang.) Exception handling (many languages) Coroutine (CS terminology/ALGOL) Semi-coroutine (CS terminology) Process (Unix/Ruby) Process (Erlang/Elixir) setjmp/longjmp (C) makecontext/swapcontext (POSIX) Task (...)
  15. Dec 2021
  16. Nov 2021
    1. What Makes Ruby on Rails Perfect for Marketplace Development?AlinaE-Commerce & SaaS StrategistMarketplaceRuby/RailsHomeBlogEntrepreneurshipWhat Makes Ruby on Rails Perfect for Marketplace Development?PublishedJul 13, 2020UpdatedJul 13, 202012 min readThe last several years have been marked with the rise of different marketplaces. Airbnb, AliExpress, Etsy, Booking.com are on everyone’s lips. That's not surprising that the idea of launching a second Amazon or eBay seems so appealing. To win the e-commerce race, entrepreneurs focus on providing excellent customer experience and build fast-loading and scalable websites. Besides, business owners take various security measures to protect their customers’ sensitive information. This way, they can gain clients’ trust and boost sales. When building a custom marketplace, what technology stack is best to achieve all these goals? Our answer is simple: Ruby on Rails. In this article, we will fill you in on the Ruby on Rails marketplace development. At Codica, we are passionate fans of this framework and have built numerous e-commerce platforms with its help. Based on our experience, we will discuss the key reasons to choose RoR for building a successful marketplace.

      The last several years have been marked with the rise of different marketplaces. Airbnb, AliExpress, Etsy, Booking.com are on everyone’s lips. That's not surprising that the idea of launching a second Amazon or eBay seems so appealing.

      To win the e-commerce race, entrepreneurs focus on providing excellent customer experience and build fast-loading and scalable websites. Besides, business owners take various security measures to protect their customers’ sensitive information. This way, they can gain clients’ trust and boost sales.

      When building a custom marketplace, what technology stack is best to achieve all these goals? Our answer is simple: Ruby on Rails.

      In this article, we will fill you in on the Ruby on Rails marketplace development. At Codica, we are passionate fans of this framework and have built numerous e-commerce platforms with its help. Based on our experience, we will discuss the key reasons to choose RoR for building a successful marketplace.

  17. Oct 2021
    1. Another option is the use the functional library Ramda, while the syntax may be a bit different from the Ruby and Pure JS version, I find it to be more declarive: list = [null, "say", "kenglish", "co", null] R.reject(R.isNil, list) // return new array [ 'say', 'kenglish', 'co' ]
  18. Sep 2021
    1. At the same time, details about programming language semantics are quite precise and when articles like this get things sort of wrong, it just leads to more confusion.
  19. Aug 2021
  20. Jun 2021
    1. Same feature in TypeScript¶ It's worth mentioning that other languages have a shortcut for assignment var assignment directly from constructor parameters. So it seems especially painful that Ruby, despite being so beautifully elegant and succinct in other areas, still has no such shortcut for this. One of those other languages (CoffeeScript) is dead now, but TypeScript remains very much alive and allows you to write this (REPL): class Foo { constructor(public a:number, public b:number, private c:number) { } } instead of this boilerplate: class Foo { constructor(a, b, c) { this.a = a; this.b = b; this.c = c; } } (The public/private access modifiers actually disappear in the transpiled JavaScript code because it's only the TypeScript compiler that enforces those access modifiers, and it does so at compile time rather than at run time.) Further reading: https://www.typescriptlang.org/docs/handbook/2/classes.html#parameter-properties https://basarat.gitbook.io/typescript/future-javascript/classes#define-using-constructor https://kendaleiv.com/typescript-constructor-assignment-public-and-private-keywords/ I actually wouldn't mind being able to use public/private modifiers on instance var parameters in Ruby, too, but if we did, I would suggest making that be an additional optional shortcut (for defining accessor methods for those instance vars) that builds on top of the instance var assignment parameter syntax described here. (See more detailed proposal in #__.) Accessors are more of a secondary concern to me: we can already define accessors pretty succinctly with attr_accessor and friends. The bigger pain point that I'm much more interested in having a succinct shortcut for is instance var assignment in constructors. initialize(@a, @b, @c) syntax¶ jsc (Justin Collins) wrote in #note-12: jjyr (Jinyang Jiang) wrote: I am surprised this syntax has been repeatedly requested and rejected since 7 years ago. ... As someone who has been writing Ruby for over 10 years, this syntax is exactly that I would like. I grow really tired of writing def initialize(a, b, c) @a = a @b = b @c = c end This would be perfect: def initialize(@a, @b, @c) end I'm a little bit sad Matz is against this syntax, as it seems so natural to me. Me too!! I've been writing Ruby for over 15 years, and this syntax seems like the most obvious, simple, natural, clear, unsurprising, and Ruby-like. I believe it would be readily understood by any Rubyist without any explanation required. Even if you saw it for the first time, I can't think of any way you could miss or misinterpret its meaning: since @a is in the same position as a local variable a would normally be, it seems abundantly clear that instead of assigning to a local variable, we're just assigning to the variable @a instead and of course you can reference the @a variable in the constructor body, too, exactly the same as you could with a local variable a passed as an argument. A workaround pattern¶ In the meantime, I've taken to defining my constructor and list of public accessors (if any) like this: attr_reader \ :a, :b def new( a, b) @a, @b = a, b end ... which is still horrendously boilerplatey and ugly, and probably most of you will hate — but by lining up the duplicated symbols into a table of columns, I like that I can at least more easily see the ugly duplication and cross-check that I've spelled them all correctly and handled them all consistently. :shrug: Please??¶ Almost every time I write a new class in Ruby, I wish for this feature and wonder if we'll ever get it. Can we please?
  21. basarat.gitbook.io basarat.gitbook.io
    1. Having a member in a class and initializing it like below:class Foo { x: number; constructor(x:number) { this.x = x; }}is such a common pattern that TypeScript provides a shorthand where you can prefix the member with an access modifier and it is automatically declared on the class and copied from the constructor. So the previous example can be re-written as (notice public x:number):class Foo { constructor(public x:number) { }}
    1. Then, people from programming communities (mainly front-end) realized that CoffeeScript is out of date and is starting to lag behind the ever-evolving Javascript environment. As of today, January 2020, CoffeeScript is completely dead on the market (though the GitHub repository is still kind of alive).
  22. Apr 2021
  23. Mar 2021
    1. Title: "goal the use case is trying to satisfy"[23]:101 Main Success Scenario: numbered list of steps[23]:101 Step: "a simple statement of the interaction between the actor and a system"[23]:101 Extensions: separately numbered lists, one per Extension[23]:101 Extension: "a condition that results in different interactions from .. the main success scenario". An extension from main step 3 is numbered 3a, etc.

      Not sure why I find this example so interesting.

      Probably because it is a human-readable outline that uses machine-readable (programming language source code) constructs, namely loops/iteration.

      The format in which this is written in, then, is itself a kind of (high-level, human-oriented) programming language.

      Example:

      • numbered list of steps [introduces/names the loop/iterator/enumeration being done]
        • Step: "a simple statement of the interaction between the actor and a system" [defines the inner part of the loop that gets "executed" once per iteration]
    1. JavaScript needs to fly from its comfy nest, and learn to survive on its own, on equal terms with other languages and run-times. It’s time to grow up, kid.
    2. If JavaScript were detached from the client and server platforms, the pressure of being a monoculture would be lifted — the next iteration of the JavaScript language or run-time would no longer have to please every developer in the world, but instead could focus on pleasing a much smaller audience of developers who love JavaScript and thrive with it, while enabling others to move to alternative languages or run-times.
  24. Feb 2021
    1. This is the most popular article “railway oriented programming” on one of the most popular websites of F #.

      I may have seen it before but not really paid attention to it, but this just might be the first time I stopped to look it up.

      Because I saw the code below, didn't recognize the language, and was intrigued.

  25. Dec 2020
  26. Nov 2020
    1. Thanks for posting this helpful, well written article. Learning programming, or any other thing one takes up, requires you to sit at one place have a plan of action for your study.

      I was going through my Firefox bookmarks and I found article. I had read this article two years back and had commented that I found it to be useful. I read it back in May 2018. As of now, November 2020, my programming skills are still novice-level. I haven't implemented the ideas or followed suggestions given here.

      It has been 2 years and 5 months since I found this article to be relevant and it baffles me that I haven't taken action by making use of the knowledge given in this article. Two long years flew by. I guess reviewing my bookmarks is something that I will do more often.

      The article was posted on May 23, 2018 and I had stumbled on it the next day itself, i.e., May 24, 2018. This gets me thinking that we could finds solutions for problems(latest ones in this case) once we identify it, articulate it, hit the search button and just read stuff. I could presume that what happened next was that I misunderstood "finding a solution" to "realizing the solution", and perhaps became complacent or maybe there were more problems that didn't come to my awareness to identify and further find solutions. I'm not quite sure. Should I have identified my problems and googled more so that I could have learned C and C++ sooner?

      I wonder what held me back from taking action to accomplish and master something that usually takes not more that 5-6 months maximum.

  27. Oct 2020
    1. JavaScript is, of course, a dynamic language that allows you to add and remove objects and their members at any point in time. For many, this is precisely why they enjoy the language: there are very few constraints imposed by the language.
  28. Sep 2020
  29. Aug 2020
    1. “I came to Rust from Haskell, and I feel that Haskell is a very elegant and safe language. The biggest differentiator for me is that there is a greater difference between high-performance code and idiomatic ‘clean’ code in Haskell than in Rust. Most Rust code looks like most other Rust code, even when it performs well. Haskell can become unfamiliar real quick if someone is operating under different libraries and goals from what you are typically doing. Small differences in syntax can result in huge differences in behavior, and Rust has more uniformity on that axis.”
    1. Then when giving answers I'm even less certain. For example I see occasional how-to questions which (IMO) are ridiculously complex in bash, awk, sed, etc. but trivial in python, (<10 lines, no non-standard libraries). On such questions I wait and see if other answers are forthcoming. But if they get no answers, I'm not sure if I should give my 10 lines of python or not.
  30. Jul 2020
    1. Most of Algol's "special" characters (⊂, ≡, ␣, ×, ÷, ≤, ≥, ≠, ¬, ⊃, ≡, ∨, ∧, →, ↓, ↑, ⌊, ⌈, ⎩, ⎧, ⊥, ⏨, ¢, ○ and □) can be found on the IBM 2741 keyboard with the APL "golf-ball" print head inserted; these became available in the mid-1960s while ALGOL 68 was being drafted. These characters are also part of the Unicode standard and most of them are available in several popular fonts.
  31. Jun 2020
  32. Apr 2020
    1. The programming language is augmented with natural language description details, where convenient, or with compact mathematical notation.
  33. Mar 2020
    1. A NackClass is the same as NilClass except for any method it does not recognize, it return the instance of itself. nack.nack.nack.nack #=> nack Note I used to call this NullClass, but "nack" seems a little more fitting a term.
  34. Jan 2020
    1. I've often wished for some standard variable to use for blocks and such. Like some people here, I had considered it. Usually I use _ but I know that means "unused" to many/most programmers. I like the % option that Clojure has.

  35. Nov 2019
  36. Oct 2019
  37. Aug 2019
  38. Oct 2018
    1. Perhaps part of the confusion - and you say this in a different way in your little memo - is that the C/C++ folks see OO as a liberation from a world that has nothing resembling a first-class functions, while Lisp folks see OO as a prison since it limits their use of functions/objects to the style of (9.). In that case, the only way OO can be defended is in the same manner as any other game or discipline -- by arguing that by giving something up (e.g. the freedom to throw eggs at your neighbor's house) you gain something that you want (assurance that your neighbor won't put you in jail).

      [9] "Sum-of-product-of-function pattern - objects are (in effect) restricted to be functions that take as first argument a distinguished method key argument that is drawn from a finite set of simple names."

    2. Sum-of-product-of-function pattern - objects are (in effect) restricted to be functions that take as first argument a distinguished method key argument that is drawn from a finite set of simple names.

      fwiu: the "finte set of simple names" are all the objects defined in the codebase e.g. in java there are no functions as such just methods attached to classes i.e. "their key argument"

    3. All you can do is send a message (AYCDISAM) = Actors model - there is no direct manipulation of objects, only communication with (or invocation of) them. The presence of fields in Java violates this.

      from what I understand in Java... there are some variables on classes (class instances) that are only acessible through methods and for those the "only send message" paradigm holds but there are also fields which are like attributes in python which you can change directly

    4. Parametric polymorphism - functions and data structures that parameterize over arbitrary values (e.g. list of anything). ML and Lisp both have this. Java doesn't quite because of its non-Object types.

      generics so you've got a "template" collection e.g. Collectoin<animal> and you parametrise it with the Animal type in this example how is that broken by "non-Object types" in java</animal>

    5. Encapsulation - the ability to syntactically hide the implementation of a type. E.g. in C or Pascal you always know whether something is a struct or an array, but in CLU and Java you can hide the difference.

      is this because:

      • interfaces--contextually identical (because satisfy common set of behaviours)?
      • or being wrapped in objects (thus blurring the difference)?
    1. Following Christopher Strachey,[2] parametric polymorphism may be contrasted with ad hoc polymorphism, in which a single polymorphic function can have a number of distinct and potentially heterogeneous implementations depending on the type of argument(s) to which it is applied. Thus, ad hoc polymorphism can generally only support a limited number of such distinct types, since a separate implementation has to be provided for each type.

      kind of like clojure multimethods but those can dispatch on arbitary function hence arbitrary "property"

    2. In programming languages and type theory, parametric polymorphism is a way to make a language more expressive, while still maintaining full static type-safety. Using parametric polymorphism, a function or a data type can be written generically so that it can handle values identically without depending on their type.[1] Such functions and data types are called generic functions and generic datatypes respectively and form the basis of generic programming.

      so essentially this is just a way to escape the contrains of types--overspecifying the type of argument for e.g. append function

      I guess the behaviour implement cannot really implement on the type of value

  39. Jan 2018
  40. Apr 2017
  41. Mar 2017
    1. Suggestion for a programming language in which commands are displayed as comic strip panels, with each one showing the output up to that point.

      https://twitter.com/jasonbrennan

  42. Jan 2016
  43. kotlinlang.org kotlinlang.org
    1. Kotlin, a statically typed language that compiles to Java bytecode or JavaScript.

  44. Dec 2015
    1. The Red programming language is based on Rebol (a Lisp-like interpreted language), but can compile binaries for several platforms. It is extremely lightweight. It covers the full range of programming tasks, from embedded systems to scripting. It's very young: they are working on a GUI library. http://www.red-lang.org/

  45. Nov 2015
    1. In my opinion one of the key properties of a scripting language is not to be found in the language itself, but rather the tools that are used to deploy it. Traditionally a script in Perl or Python can just be run, without explicitly invoking a complex compilation and linkage script.

      A good point, but unlike the author, I still feel that having a REPL is also important for distinction as a scripting language, as it facilitates rapid prototyping.

    2. almost all languages are dynamic and involve dynamic typing, even languages like Ocaml and Haskell. Every time your code interprets data and makes choices based on that, you have dynamic typing. The simple fact is that there's no hard and fast distinction between type information and data: constraints on data, such as the format of a stream of text, are type constraints which are beyond the static type system to check, so the checks are done dynamically at run time by your code, and that's dynamic typing!

      An interesting perspective, which is a bit like the dual of the Lisp mantra: "code is data".

  46. Sep 2015
  47. Jul 2015
  48. Nov 2014
    1. Python was created by Guido Van Rossum in the early 90s. It is now one of the most popular languages in existence. I fell in love with Python for its syntactic clarity. It’s basically executable pseudocode.

      Helpful concise, Python syntax doc

    1. Full Text Beginning Perl Modern Perl Impatient Perl Extreme Perl Embedding Perl in HTML with Mason Picking Up Perl Perl 5 Internals Practical Mod Perl Perl & LWP

      Full e-books on Perl

    1. The goal of this site is to provide a set of materials in support of my Python for Informatics: Exploring Information book to allow you to learn Python on your own. This page serves as an outline of the materials to support the textbook.

      http://www.pythonlearn.com/ | A great resource for starting programmers looking to build knowledge and gain skills. Open Source Course

  49. Feb 2014
    1. The Benjamin Franklin Programming Practice Model
      • Find a program that you greatly admire and read it.
      • Takes note on the roles, inputs, and outputs of each major component.
      • Take notes on how the components interact.
      • Rewrite the program.
      • Compare your code with the original.
      • Note where you can improve and study accordingly.
    2. The hard part is teaching the consequences of each choice.

      Once you get the syntax and basic language idioms out of the way this is the real problem that faces us no matter what language we pick.