This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module A | |
def A.included(klass) | |
klass.instance_exec do | |
@@foo = 0 | |
def inc() | |
puts self.object_id | |
puts @@foo | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module AbstractClass | |
def self.included(klass) | |
klass.instance_exec do | |
@abstract_class = klass | |
def self.new(*args) | |
if self == @abstract_class | |
raise "Instantiating abstract class #{self} is not allowed." | |
else | |
super |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ruby Language Toolkit | |
require 'rltk/cg/llvm' | |
require 'rltk/cg/module' | |
require 'rltk/cg/execution_engine' | |
require 'rltk/cg/target' | |
require 'rltk/cg/type' | |
require 'rltk/cg/value' | |
RLTK::CG::LLVM.init(:all) | |
RLTK::CG::LLVM.init_asm_parser(:all) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyClass { | |
template <typename IntType> | |
inline operator typename std::enable_if<std::is_integral<IntType>::value, IntType>::type () { | |
// Integer specific code. | |
} | |
template <typename FloatType> | |
inline operator typename std::enable_if<std::is_floating_point<FloatType>::value, FloatType>::type () { | |
// Float specific code. | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef RATIONAL_H | |
#define RATIONAL_H | |
/* | |
* Standard Includes | |
*/ | |
#include <type_traits> | |
/* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyVisitor < RLTK::Visitor | |
def wrapper_fun | |
... | |
yield | |
... | |
end | |
# Option 1 | |
on KlassName do | |
wrapper_fun do |params| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline proc chpl__defaultHash(ref aflag:atomic_flag):int(64) { | |
if (atomic_load_explicit_flag(aflag, memory_order_consume)) then | |
return 0; | |
else | |
return 1; | |
} | |
inline proc chpl__defaultHash(ref auint:atomic_uint_least8_t):int(64) { | |
return _gen_key(atomic_load_explicit_uint_least8_t(auint, memory_order_consume):int(64)); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[me@dhalgren ~]$ rake | |
/usr/share/rubygems/rubygems/dependency.rb:296:in `to_specs': Could not find 'rake' (>= 0) among 5 total gem(s) (Gem::LoadError) | |
from /usr/share/rubygems/rubygems/dependency.rb:307:in `to_spec' | |
from /usr/share/rubygems/rubygems/core_ext/kernel_gem.rb:47:in `gem' | |
from /home/me/.gem/bin/rake:22:in `<main>' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# | |
# This file was generated by RubyGems. | |
# | |
# The application 'rake' is installed as part of a gem, and | |
# this file is here to facilitate running it. | |
# | |
require 'rubygems' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <utility> | |
class Foo { | |
public: | |
void operator=(Foo&& other); | |
}; | |
int main(void) { | |
Foo a, b; | |
OlderNewer